[gdal-dev] Beginner (load DTED)

Even Rouault even.rouault at mines-paris.org
Tue Feb 9 14:56:15 EST 2010


Using GDAL for reading DTED 2 (and more generally elevation data) is a 
perfectly valid and common use case.

I'd encourage you reading http://gdal.org/gdal_datamodel.html first and then 
looking at the API doc.

The DTED grid is seen as a standard raster. So if gt is the geotransform 
returned by GDALGetGeoTransform(), (x,y) the pixel coordinates in the DTED 
file corresponding to the (longitutde, latitude) you're interested in, you 
have the following relationship :

x = (longitude - gt[0]) / gt[1]
y = (latitude - gt[3]) / gt[5]

Then using GDALRasterIO(), you should be able to extract a region into a 
buffer of yours and compute the max elevation.

As far as performance are concerned, the column orientation of DTED is 
generally a bit painful when using scanline oriented algorithms. You might 
want to bench for your use case if setting the GDAL_DTED_SINGLE_BLOCK 
environment variable to TRUE might help. See http://gdal.org/frmt_dted.html

Best regards

Even

> Hi,
>
>
>
> I'm beginner in development using GDAL. So I'd like some advises and
>
> tips, let me explain what I need to do.
>
>
>
> I need to load a DTED file level 2 and given the parameters
>
> latitude,longitude and width I must create a region (rectangle) and
>
> find the highest elevation in the grid points inside this rectangle. I
>
> need it to be fast, I don't know exaclty how slow GDAL is, so I need
>
> to understand which strategies to useds to increase de speed of this
>
> routine.
>
>
>
> I didn't find source code examples of DTED loading with GDAL, So there
>
> are lot's of doubts I have, such as how GDAL stores the DTED since it
>
> was loaded (in an image file?), how to represent this grid area (a
> polygonon area with elevation points), how to get the elevation of a point
>
> given (lat, lon).
>
> I'd be glad to receive examples, references and tips about it.
>
>
>
> Thanks
>
> Ricardo




More information about the gdal-dev mailing list