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

Luca Bertoncello lucabert at lucabert.de
Tue Dec 28 11:51:50 PST 2021


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)


More information about the gdal-dev mailing list