[Gdal-dev] DEM 'no_data' specification

Frank Warmerdam warmerdam at pobox.com
Tue Feb 4 16:56:41 EST 2003


Jim Julian wrote:
> 
>  Hi,
> 
>    Does GDAL allow user specification of a 'no_data' value for DEM? If
>  not, would it be practical/possible to add this?
>  My idea is this:
>     Images are a perfect media for porting information to mainstream,
>  non-GIS applications, e.g. Matlab, image analyzers, etc. Since 'no_data'
>  specifications are merely position holders in the file, allowing the user
>  to specify their own value would resolve some data scaling problems
>  in other applications, as well as allowing construction of visually 
> accurate
>  data images .

Jim,

There are methods in the GDAL API for getting and setting the nodata values
for a band, but few formats actually support the set method and only slightly
more support the get method (generally because the underlying format has no
concept of nodata).

There are no user applications to call the setdata/getdata methods, though it
can be done from Python.

If I had a dataset that I wanted to have a particular nodata value I would
likely copy it to VRT format (creating an XML virtual file referring to the
original), and add the nodata spec to that .vrt file by hand.

In a .vrt file the nodata spec would look something like this:

...
   <VRTRasterBand dataType="Byte" band="1">
     <NoDataValue>255</NoDataValue>
     <SimpleSource>
...

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent





More information about the Gdal-dev mailing list