[Gdal-dev] DEM projection conversion

Frank Warmerdam warmerdam at pobox.com
Mon Jun 7 20:17:59 EDT 2004


Jean-Denis Giguere wrote:
> Hi list,
> 
> I have USGS-DEM data and I would like to convert them in rasters in 
> Lambert projection. I want to use these rasters with MapServer. I have 
> tried to convert them in several format (pcidsk, hfa and bt) with 
> gdalwarp, but the output rasters are always envelopped and I have bad 
> result when I use gdaltindex after.
> 
> This is a sample execution of gdalwarp, maybye I don't use correct 
> options...
> $ gdalwarp -of BT \
> -s_srs '+proj=latlong +datum=NAD83' \
> -t_srs '+init=epsg:42304' \
> some_dem_file some_dem_file.bt
> 
> Any idea to solve this problem will be greatly appreciated.

Jean-Denis,

can you be more specific about what you mean by "enveloped"?  Is the
issue that you have triangles of "nodata" in the output product?  This is
to be expected.  Are you unclear about how to use this data in MapServer
in such a way that the triangles of nodata are not rendered?

First, you should ensure the nodata areas are produced with a value that
is distict from valid values.  You might do this something like:

   gdalwarp -of BT -dstnodata -100 -wt Int16 \
     -s_srs '+proj=latlong +datum=NAD83' \
     -t_srs '+init=epsg:42304' \
     some_dem_file some_dem_file.bt

This forces "nodata areas", that is areas with no value written to them to
be initialized to -100.  The "-wt Int16" forces use of the Int16 type in
the warp ... and hopefully results in the output file being of type Int16
though I think that is implicit with BT format.

Ensuring the "nodata" value isn't used in MapServer is a bit tricky though.
If this was just 8bit greyscale data, you could just use the OFFSITE keyword
in the raster layer in MapServer.  However, if you are allowing MapServer to
autoscale your DEM data, the offsite stuff likely won't work quite like you
expect since the value it is looking for will be the post-scaling value.

If this is your issue, we will need to look at enhancements to MapServer or
perhaps preprocessing your data to 8bit in gdal_translate in such a way that
your nodata value remains distinct.

Best regards,

-- 
---------------------------------------+--------------------------------------
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