[gdal-dev] DEM handling in GDAL

Even Rouault even.rouault at spatialys.com
Mon May 25 09:19:03 PDT 2020


On lundi 25 mai 2020 18:00:35 CEST Cédric Traizet wrote:
> Thanks for your answer, In addition to the extraction of values from the
> DEM raster, these functions implement the interpolation of the DEM
> height on any point. Is there any chance to have this kind of function
> in the public API someday ? In my project I want to use the GDAL RPC
> algorithms, but I also need to use DEM in other processings, so I wanted
> to know if there was a way to reuse these DEM routines. Anyway, it
> shouldn't be too hard to re-implement the DEM interpolation in my code.$

I see your point now.

You can probably accomplish what you want by using the GDALRasterIOExtraArg argument 
of the RasterIO function, by setting bFloatingPointWindowValidity to TRUE and setting 
dfXOff, dfYOff, dfXSize, dfYSize

You'll likely have to play with half-pixel shift. If you want an interpolated value at (X_georef, 
Y_georef),

dfXOff = (X_georef - gt[0]) / gt[1] - 0.5
dfYOff = (Y_georef - gt[3]) / gt[5] - 0.5
dfXSize = dfYSize = 1

(untested)

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200525/dbbfbfd2/attachment.html>


More information about the gdal-dev mailing list