Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#7001 closed defect (fixed)

[New for GDAL 2.2.x] "gdalwarp" with resampling+nodata doesn't work properly

Reported by: justinmilk Owned by: warmerdam
Priority: high Milestone: 2.2.2
Component: default Version: 2.2.0
Severity: normal Keywords:
Cc:

Description

Recently I have upgraded GDAL from v2.1.0 straight to v2.2.1 and, unfortunately, noticed some discrepancies when using "gdalwarp".

Starting with v2.2.0 (I've tested) "gdalwarp" with simultaneous use of '-r cubic' and '-srcnodata 0' options seems to cut less pixels from the border and sometimes leads to "corrupted" data border, which previously (in v2.1.0) wasn't the case. I couldn't find anything relating to this in the release notes and error threshold option ('-et') control did nothing for me, so I've decided to file a report.

In attachment I'm providing results of performing the following command on B2 band of Landsat 8 scene - https://landsat-pds.s3.amazonaws.com/L8/044/034/LC80440342015224LGN00/index.html - with GDAL v2.1.0 (B2_10.TIF) and GDAL v2.2.1 (B2_21.TIF) respectively:

gdalwarp -r cubic -te_srs "+proj=longlat +datum=WGS84 +no_defs " -te -123.22265625 37.4399740523 -123.046875 37.5794125134 -t_srs "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs" -ts 256 256 -dstalpha -srcnodata 0 B2.TIF B2_21.TIF

Further testing showed that without '-srcnodata' all new versions of GDAL produce identical output, and other resampling methods are affected too.

In addition, when using '-r near' in GDAL v2.2.x, '-dstalpha' option doesn't produce expected result, seemingly ignoring nodata value and returning fully untransparent array (which wasn't the case in GDAL v2.1.0).

Attachments (2)

B2_10.TIF (256.9 KB ) - added by justinmilk 7 years ago.
v2.1.0
B2_21.TIF (256.9 KB ) - added by justinmilk 7 years ago.
v2.2.1

Download all attachments as: .zip

Change History (5)

by justinmilk, 7 years ago

Attachment: B2_10.TIF added

v2.1.0

by justinmilk, 7 years ago

Attachment: B2_21.TIF added

v2.2.1

comment:1 by Even Rouault, 7 years ago

Resolution: fixed
Status: newclosed

In 39827:

Warper: when operating on single-band, skip target pixels whose source center pixel is nodata (2.2 regression, fixes #7001)

comment:2 by Even Rouault, 7 years ago

In 39828:

Warper: when operating on single-band, skip target pixels whose source center pixel is nodata (2.2 regression, fixes #7001)

comment:3 by Even Rouault, 7 years ago

Milestone: 2.2.2

Thanks for the report. Issue noww fixed. You can also workaround the issue by adding explicitly " -wo UNIFIED_SRC_NODATA=YES"

Note: See TracTickets for help on using tickets.