zero vs null
Zenon Panoussis
oracle at PROVOCATION.NET
Tue Aug 22 22:35:42 PDT 2006
I am processing landsat images for use with mapserver. Because of
various problems (discussed in the the thread "Landsat image tiffs")
I have to use r.out.tiff to export the scenes from grass, then add
the geometry and projection with gdal_translate and finally reproject
the images with gdalwarp. Doing this leaves an ugly black edge in the
final images in the area between the source projection and the target
projection. As far as I can figure, this is caused by gdalwarp using
0 instead of null for nodata.
After a lot of hit-and-miss with -dstnodata and other such, I found
a workaround for this by running 'r.null map=xyz null=0' on the source
raster before exporting it. This way the resulting image has R=0 G=0 B=0
where nodata used to be, so those areas are identical to what gdalwarp
introduces during the reprojection, so I can get rid of all of it in
mapserver with a simple "OFFSITE 0 0 0".
This is not a good way of doing it though. For one, if an image has
valid data pixels that are black, they will be removed too, as if they
were nodata. For another, if I would later want to run r.patch on these
rasters, I'd be unable to because null is gone.
There has to be some better way to get rid of the gdalwarp reprojection
differences, but I can't find it. I'm sure someone here has had this
very same problem before me and solved it in a smarter way.
Any clues, please?
Z
More information about the MapServer-users
mailing list