bugpktools - Bugs: bug #44800, error when trying to use...

 
 

bug #44800: error when trying to use pkcomposite

Submitted by:  None
Submitted on:  Fri 10 Apr 2015 01:52:37 PM UTC  
 
Category: command line utilitySeverity: 3 - Normal
Item Group: NoneStatus: Invalid
Privacy: PublicAssigned to: Pieter kempeneers <kempenep>
Open/Closed: ClosedOperating System: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 16 Apr 2015 11:00:55 AM UTC, comment #3:

Hi Maggie,

I think the error is due to the projection option -a_srs. Unlike gdalwarp, I do not support re-projections. You need gdalwarp for that. Notice the difference between -a_srs (assign projection) and -t_srs (target projection). As for gdal_translate, the -a_srs is just to assign a projection to the output image. You should normally not set this option in pkcomposite, as the projection is automatically copied from the input images. I only support the -a_srs in case not all parameters are correctly set in the input image (for example the EPSG code is missing).
I admit this is not clear from the documentation and I will change that.

I suggest to first re-project all your input imagery to EPSG:102001 using gdalwarp -t_srs epsg:102001. Then you can use pkcomposite on the reprojected images for the composite step.

I hope this helps. Let me know if it works.

Pieter.

Pieter kempeneers <kempenep>
Project AdministratorIn charge of this item.
Mon 13 Apr 2015 03:32:59 PM UTC, comment #2:

Hi Pieter,

Thanks for your response. I tried creating a username but never got the email to confirm--I will try that again. Sorry for my lack of information. After using -v 1 it's become clear that I am doing something wrong with the bounding box coords and/or projection.

Hopefully it will help if I try and explain a little more in depth exactly what it is I'm trying to do. The info you requested is at the bottom.

I have several images (as many as 20-30, but for now am just troubleshooting with 6 of them), each of which is smaller than the bounding box I supplied and in a different projection than I wish the output to be in. Each image overlaps a little bit with at least one other image. I would like to mosaic (or composite) them together, with the output being put into the supplied projection (EPSG:102001 a.k.a. Albers equal area) and have whatever is hanging outside of the bb be cropped out. Each input is 8-bit 30m resolution, which is what I want the output to be as well.

I was able to do this very thing using gdalwarp, by supplying the desired output projection with the desired extent, which were specified in the output proj units (the same exact coordinates which I tried to use with pkcomposite). Gdalwarp successfully combined the images, set the output projection to Albers, and cropped any excess that was outside of the bounding box. Here is the gdalwarp command I used:

'gdalwarp -t_srs EPSG:102001 -te (xmin, ymin, xmax, ymax) -tr 30 30 -srcnodata 0 input output'
where:
xmin, ymin, xmax, ymax = -1240020, 1400000, -160020, 2480000
input = string of paths to input images and output = path to output image

The only problem with gdalwarp is, I really need the result of any pixels that overlap to come from the maximum value of the inputs, not the last image, hence why I need to use pkcomposite.

I hope this is not too confusing and helps you understand what I'm trying to do.

Thanks so much!

-----------------------------------------------------------

**gdalinfo on one of the images reveals the following:

Driver: GTiff/GeoTIFF
Files: /att/nobackup/mwooten3/Processing_v3/SceneTotals_v3/043017/043017_2000_LandTotal_v3.tif
Size is 8621, 8441
Coordinate System is:
PROJCS["UTM Zone 12, Northern Hemisphere",
GEOGCS["Unknown datum based upon the WGS 84 ellipsoid",
DATUM["Not_specified_based_on_WGS_84_spheroid",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",-111],
PARAMETER["scale_factor",0.9996],
PARAMETER["false_easting",500000],
PARAMETER["false_northing",0],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]]]
Origin = (428685.000000000000000,6953415.000000000000000)
Pixel Size = (30.000000000000000,-30.000000000000000)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 428685.000, 6953415.000) (112d23'38.13"W, 62d42'15.49"N)
Lower Left ( 428685.000, 6700185.000) (112d17'43.90"W, 60d25'53.91"N)
Upper Right ( 687315.000, 6953415.000) (107d20'33.15"W, 62d39'48.70"N)
Lower Right ( 687315.000, 6700185.000) (107d36' 0.67"W, 60d23'40.33"N)
Center ( 558000.000, 6826800.000) (109d54'28.66"W, 61d34'13.12"N)
Band 1 Block=8621x1 Type=Byte, ColorInterp=Gray

**-v 1 on the same pkcomposite command gives me this info:

resampling: nearest neighbor
possible output data types: Unknown Byte UInt16 Int16 UInt32 Int32 Float32 Float64 CInt16 CInt32 CFloat32 CFloat64
Output pixel type: Byte
/att/nobackup/mwooten3/Processing_v3/SceneTotals_v3/043017/043017_2000_LandTotal_v3.tif not within bounding box, skipping...
/att/nobackup/mwooten3/Processing_v3/SceneTotals_v3/043018/043018_2000_LandTotal_v3.tif not within bounding box, skipping...
/att/nobackup/mwooten3/Processing_v3/SceneTotals_v3/043019/043019_2000_LandTotal_v3.tif not within bounding box, skipping...
/att/nobackup/mwooten3/Processing_v3/SceneTotals_v3/043020/043020_2000_LandTotal_v3.tif not within bounding box, skipping...
/att/nobackup/mwooten3/Processing_v3/SceneTotals_v3/031022/031022_2000_LandTotal_v3.tif not within bounding box, skipping...
/att/nobackup/mwooten3/Processing_v3/SceneTotals_v3/031023/031023_2000_LandTotal_v3.tif not within bounding box, skipping...
bounding box input images (ULX ULY LRX LRY): 0.000000 0.000000 0.000000 0.000000
bounding box composite image (ULX ULY LRX LRY): -1240020.000000 2480000.000000 -160020.000000 1400000.000000
initializing composite image...
composite image dim (nrow x ncol): -2147483648 x -2147483648
weight: 1 1 1 1 1 1

open output image /att/nobackup/mwooten3/Processing_v3/pk_TileIterations_v3/h02v02/h02v02_2_2000_Land_v3_pkComp.tif with 0 bands
FileOpenError ()
projection: EPSG:102001
pkcomposite: ImgWriterGdal.cc:314: std::string ImgWriterGdal::setProjectionProj4(const string&): Assertion `m_gds' failed.
Aborted

Maggie <mwooten3>
Sat 11 Apr 2015 07:23:00 AM UTC, comment #1:

Dear,

Thanks for your message.

1) Could you post the result of a gdalinfo command on your input dataset. There is no need to provide all six results, but please check if a you get reasonable results on all of them.

gdalinfo /path/im1.tif

2) Please try the same pkcomposite command with the verbose option (pkcomposite -v 1) and report on the result. More specific, I would be interested in the output of --ulx --uly --lrx --lry

3) Ideally, provide a minimal set of input images so I can reproduce the error and do some testing. If the images are too big, you can first crop them to minimalistic images either with gdal_translate or pkcrop. In this case, I would suggest to use gdal_translate:
gdal_translate -projwin ulx uly lrx lry /path/im1.tif /path/im1_crop.tif

Please first check if the error still occurs with the cropped images.

All the best,

Pieter.

Pieter kempeneers <kempenep>
Project AdministratorIn charge of this item.
Fri 10 Apr 2015 01:52:37 PM UTC, original submission:

I get the following error when trying to use pkcomposite:

FileOpenError ()
pkcomposite: ImgWriterGdal.cc:314: std::string ImgWriterGdal::setProjectionProj4(const string&): Assertion `m_gds' failed.
Aborted

The command looks somewhat (with exact paths and filenames removed) like this:

pkcomposite -i /path/im1.tif -i /path/im2.tif -i /path/im3.tif -i /path/im4.tif -i /path/im5.tif -i /path/im6.tif -o /path/output.tif -ulx -1240020 -uly 2480000 -lrx -160020 -lry 1400000 -cr maxallbands -srcnodata 0 -ot Byte -a_srs EPSG:102001

Any assistance would be greatly appreciated, thank you!

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by mwooten3 (Posted a comment)
  • -unavailable- added by kempenep (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 03 Jun 2015 04:06:07 PM UTCkempenepCategoryNone=>command line utility
      Open/ClosedOpen=>Closed
    Thu 16 Apr 2015 11:00:55 AM UTCkempenepStatusNeed Info=>Invalid
    Sat 11 Apr 2015 07:23:00 AM UTCkempenepStatusNone=>Need Info
      Assigned toNone=>kempenep

    Back to the top


    Powered by Savane 3.1-cleanup1