[GRASSLIST:8305] Re: Setting Null Values

Hamish hamish_nospam at yahoo.com
Fri Sep 16 01:30:25 EDT 2005


> I have some scanned topographic maps in geotiff format.  When I try  
> to import them, r.in.gdal tells me that they are not orthogonal and I 
> need to straighten them with gdalwarp.   This works fine but as the  
> map is rotated,  I get black slivers along the edges of the maps.
> 
> I want to patch the maps together.  If I set the black slivers to  
> NULL with r.patch -z or r.null the valid black content in the map  
> disappears as well.
> 
> Is there a way I can use the -dstnodata feature of gdalwarp to set  
> the 'nodata' portions of the output map directly to a NULL value that 
> grass will recognize on input?
> 
> Or is there some other way to solve this problem?


Depending on what you want to do with them, I've found setting GDAL's
nodata value to white (255 for an 8-bit image) makes it so when plotted
on a white background the white holes don't really show up. A better
solution might be to load into GIMP/Photoshop, select by color, and
change all white or black pixels to black+1 or white-1, then let gdal
introduce black/white borders and r.null only crop out real NULL values,
but not noticeable to the eye.

Others will probably know how to do this reclassification using the
GDAL tools without having to use a paint program.



Hamish




More information about the grass-user mailing list