[gdal-dev] ReprojectImage and nodata

Ochs, Elke ERDC-RDE-CRREL-NH Elke.Ochs at erdc.dren.mil
Wed Oct 23 10:31:34 PDT 2013


Thank-you Even,

The source nodata values that are erased in the target data source aren't 0, but interpolated values based on surrounding non-nodata values.

I am using bilinear resampling in both my ReprojectImage and gdalwarp tests.  I don't know if that makes any difference (sorry I didn't include that in my 1st post).

Elke

-----Original Message-----
From: Even Rouault [mailto:even.rouault at mines-paris.org] 
Sent: Wednesday, October 23, 2013 1:26 PM
To: gdal-dev at lists.osgeo.org
Cc: Ochs, Elke ERDC-RDE-CRREL-NH
Subject: Re: [gdal-dev] ReprojectImage and nodata

Le mercredi 23 octobre 2013 19:05:18, Ochs, Elke ERDC-RDE-CRREL-NH a écrit :
> ReprojectImage does not maintain areas of nodata as I would expect it 
> should.  Small areas of nodata are getting erased and larger areas are 
> reduced in size.  I'm reprojecting from geographic to Albers, using 
> approximately the same  cell size (converted from dd to meters).  I'm 
> using GDAL 1.9.2 in Python.
> 
> Gdalwarp does a better job of maintaining nodata cells.  Is there a 
> way to get ReprojectImage to handle nodata in a similar way?

Elke,

Always difficult to diagnose those problems as there are a few variables to consider.
Looking at the code of GDALReprojectImage(), I see it should take into account the source nodata value, but it will ignore the nodata value that you may have set on the target dataset, contrary to gdalwarp. That might be your issue. 
Your source nodata values are likely to become 0 in the target datasource.

Even

--
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list