Opened 13 years ago

Closed 13 years ago

#2853 closed defect (fixed)

gdalwarp cutline off source problems

Reported by: warmerdam Owned by: warmerdam
Priority: normal Milestone: 1.6.1
Component: Utilities Version: 1.6.0
Severity: normal Keywords: gdalwarp
Cc: vjetly



I came across an issue while using gdalwarp (gdal-16) while specifying a tiling extent and a cutline to warp an image into a new image. The cutline is completely outside the source image but intersects the target extent. Here is what I’m experiencing with the attached files:

  1. Using the cutline with the target extent results in errors
  1. Using the cutline with the target extent and using -wo "SKIP_NOSOURCE=YES" works fine
  1. Using the cutline without the target extent and without -wo "SKIP_NOSOURCE=YES" also works fine

Here is my command output for the first case:

e:\DEV>gdalwarp -te -79.980468750000000 39.55078125 -79.8046875  39.726562500000000 -cutline E:\DEV\2009\Frank\skip_nosource\alpha.shp E:\DEV\2009\Frank\skip_nosource\band1_lzw_lr.tif E:\DEV\2009\Frank\skip_nosource\out.tif
Creating output file that is 31641P x 31641L.
Processing input file E:\DEV\2009\Frank\skip_nosource\band1_lzw_lr.tif.
ERROR 1: Attempt to create 7911x0 dataset is illegal,sizes must be larger than zero.
ERROR 10: Pointer 'hDataset' is NULL in 'GDALAddBand'.
ERROR 10: Pointer 'hDS' is NULL in 'GDALSetGeoTransform'.

I also get a ‘gdalwarp.exe has encountered a problem and needs to close. We are sorry for the inconvenience’ popup. Please let me know what you find.



Attachments (1) (48.6 KB ) - added by warmerdam 13 years ago.
example data demonstrating problem.

Download all attachments as: .zip

Change History (3)

by warmerdam, 13 years ago

Attachment: added

example data demonstrating problem.

comment:1 by warmerdam, 13 years ago

Milestone: 1.6.1
Status: newassigned

I have confirmed the problem, and it is due to increasingly zealous checking for rasters with a dimension of zero in x or y. The warper asks for a source rectangle that has an xsize of zero and the low level code fails to create a memory dataset of this degenerate size.

Using NOSOURCE avoids this operation.

So the problem is only with the cutline related code, and is new in 1.6.

The fix is in trunk (r16414) and 1.6 branch (r16415).

I will regenerate the gdal16 package before closing the ticket.

comment:2 by warmerdam, 13 years ago

Resolution: fixed
Status: assignedclosed

OSGeo4W gdal16 1.6.0-8 package uploaded.

Note: See TracTickets for help on using tickets.