<tt><font size=2>Hello all,<br>
I'm running into an issue reprojecting a single band geotif
in python. <br>
My code works fine on pixel types other than signed byte. What I'm
seeing<br>
is that the interpolation that includes a nodata pixel uses the literal<br>
nodata value (-128 is the nodata but I think this is being interpreted
as<br>
128). In my example I have a grid with values between 0 and 60 and
areas of<br>
nodata. Pixels bordering the nodata areas have values up to 126 in
the<br>
output. I've also tried to recreate this process using gdalwarp
and I<br>
think I'm getting the same problem.<br>
<br>
Thanks for any help or projections. FYI I'm on GDAL 1.8<br>
<br>
Attached are the small test files I'm using. BigSage.tif is the input,<br>
template2.tif has the projection info and extent I'm using for the output,<br>
output.tif is what I'm getting.<br>
</font></tt><a href="http://osgeo-org.1560.n6.nabble.com/file/n4967005/BigSage.tif"><tt><font size=2>http://osgeo-org.1560.n6.nabble.com/file/n4967005/BigSage.tif</font></tt></a><tt><font size=2>
BigSage.tif <br>
</font></tt><a href="http://osgeo-org.1560.n6.nabble.com/file/n4967005/template2.tif"><tt><font size=2>http://osgeo-org.1560.n6.nabble.com/file/n4967005/template2.tif</font></tt></a><tt><font size=2><br>
template2.tif </font></tt><a href="http://osgeo-org.1560.n6.nabble.com/file/n4967005/output.tif"><tt><font size=2>http://osgeo-org.1560.n6.nabble.com/file/n4967005/output.tif</font></tt></a><tt><font size=2><br>
output.tif <br>
<br>
Below is a striped down version of my code:<br>
tifDriver = gdal.GetDriverByName("GTiff")<br>
tmpOutDataset = tifDriver.Create(tmpOutput, width, height, 1, gdal.GDT_Byte,<br>
["PIXELTYPE=SIGNEDBYTE"])<br>
#omited code to set cell size, geotransform, NoData, projection<br>
tmpOutDataset.GetRasterBand(1).PixelType = "SIGNEDBYTE"<br>
tmpOutDataset.GetRasterBand(1).SetMetadata({'PIXELTYPE': 'SIGNEDBYTE'},<br>
'IMAGE_STRUCTURE')<br>
<br>
err = gdal.ReprojectImage(srcDs, tmpOutDataset, sourcesrs.ExportToWkt(),
<br>
templatesrs.ExportToWkt(),<br>
gdal.GRA_Bilinear)<br>
<br>
<br>
--<br>
View this message in context: </font></tt><a href="http://osgeo-org.1560.n6.nabble.com/python-gdal-gdal-ReprojectImage-not-masking-NoData-in-signed-byte-geotifs-tp4967005.html"><tt><font size=2>http://osgeo-org.1560.n6.nabble.com/python-gdal-gdal-ReprojectImage-not-masking-NoData-in-signed-byte-geotifs-tp4967005.html</font></tt></a><tt><font size=2><br>
Sent from the GDAL - Dev mailing list archive at Nabble.com.</font></tt>
<br>
<br>
<br>
<br><font size=2 face="sans-serif">Colin Talbert<br>
GIS Specialist<br>
US Geological Survey - Fort Collins Science Center<br>
2150 Centre Ave. Bldg. C<br>
Fort Collins, CO 80526<br>
<br>
(970) 226-9425<br>
talbertc@usgs.gov<br>
</font>