[gdal-dev] Get max elevation on "squares"

Volker Wichmann wichmann at laserdata.at
Wed Dec 29 01:30:56 PST 2021


Hi Luca,

I haven't followed the discussion in detail, but you could use

https://gdal.org/programs/gdallocationinfo.html

to read out the values from your resampled raster.

The elevation differences between high and coarse resolution DEMs 
strongly depend on the relief in the area of investigation. So the 
differences between 25m and 5000m DEMs might be quite significant. Maybe 
better query the path on the high resolution and then smooth the profile 
afterwards (to keep min/max values for example).

Another approach would be to resample your high res DEM with the min/max 
resampling options of

https://gdal.org/programs/gdalwarp.html

and thus create low res DEMs with the extreme values.


Best regards,
Volker


On 12/28/21 20:51, Luca Bertoncello wrote:
> Am 28.12.2021 um 04:54 schrieb Alan Snow:
>> After some thought, you may achieve what you want by resampling the file
>> to a 5km grid size with the Resampling.max option:
>>
>> https://rasterio.readthedocs.io/en/latest/topics/resampling.html
>>
>> https://rasterio.readthedocs.io/en/latest/api/rasterio.enums.html#rasterio.enums.Resampling.max
>>
>> You can then store the centroid of the grid cell and the value in a
>> database.
> 
> So, maybe I got something...
> I started with the EU DEM data from
> https://land.copernicus.eu/imagery-in-situ/eu-dem/eu-dem-v1.1?tab=download
> Then I created a VRT file of a part of these data, about what I need
> (later I'll refine the sampling):
> 
> gdalbuildvrt -tr 25 25 -tap -te 3000000 1000000 8000000 6000000 r.vrt
> ../eudem/*.TIF
> 
> and then I resample the data saving all in a TIFF file:
> 
> gdalwarp -tr 5000 5000 r.vrt ../x/x.tif
> 
> Now I have a TIFF file with a resolution of 5x5 km (I hope):
> 
> $ gdalinfo -mm x.tif
> ....
> Origin = (3000000.000000000000000,6000000.000000000000000)
> Pixel Size = (5000.000000000000000,-5000.000000000000000)
> Metadata:
> .....
> 
> Do I am right until now?
> I checked some known location (airports) and I see the elevation from
> the 25 meter precision VRT file is better (of course) but the elevation
> from the 5 km precision TIFF file is quite accurate, with a difference
> of less than 10 meter. To create a vertical profile using during the
> flight 10 meter are damned good.
> 
> Now I have to extract the data and save them in a SQLite file...
> And I don't know how to do it per Script... :(
> 
> Any help?
> 
> Or maybe there are a Java-Library to using in Android to read the TIFF file?
> 
> Thanks
> Luca Bertoncello
> (lucabert at lucabert.de)
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
> 


More information about the gdal-dev mailing list