[Gdal-dev] DEM projection conversion

Jean-Denis Giguere jdenisgiguere at fastmail.fm
Mon Jun 7 21:07:37 EDT 2004


Frank Warmerdam a écrit :
> 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,
> 

Thank you very much Frank,

I will try to precise a little bit what is my problem. It's not really 
problematic to see region with no data displayed. However, your advice 
will consederably improve output graphical quality. My problem is when I 
use gdaltindex to create tile for my rasters. I have contiguous rasters 
in latlong but, the converted rasters are larger and overlap.

+-+-+         +--+
| | |         |/+--+
+-+-+ become  +-|//|
| | |         |/+--+
+-+-+         +-|//|
                 +--+


Result, some no-data area hide data.

Hope this clarify a little bit,

Jean-Denis



More information about the Gdal-dev mailing list