This resource is useful to help you get started exploring raster data with Python:
https://carpentries-incubator.github.io/geospatial-python/05-raster-structure/index.html https://www.earthdatascience.org/courses/use-data-open-source-python/intro-raster-data-python/raster-data-processing/ If the CRS of your raster is not in meters, you will need to reproject your raster. I recommend changing the grid cell size in the same operation and using Resampling.max. Here are some helpful references: https://rasterio.readthedocs.io/en/latest/topics/virtual-warping.html https://corteva.github.io/rioxarray/stable/examples/reproject.html#Reproject-Large-Rasters-with-Virtual-Warping On Tue, Dec 28, 2021, 12:56 AM Luca Bertoncello <[email protected]> wrote: > Am 28.12.2021 um 04:54 schrieb Alan Snow: > > Hi Alan > > > After some thought, you may achieve what you want by resampling the file > > to a 5km grid size with the Resampling.max option: > > This is a good idea... I will need to write some code in Python (I don't > really know this language), but I think I'll get it... > > > You can then store the centroid of the grid cell and the value in a > > database. > > Yes, I already see with gdalinfo -mm (maybe there is a possibility to > check it with Python?) I can get the maximum elevation and the centroid. > > Just some question, to correctly understand the code sample: > > 1) I think, dataset.read get the size as parameter, correct? Are there > meter/kilometer/something other? > I searched some information about DatasetReader.read but I didn't found > anything... > 2) In the example the new image will not be saved, is it correct? How > can I do that? I didn't found any function DatasetReader.save... > 3) Maybe is it possible to do that in BASH? As I sayd, I'm not really > fit in Python... :( > > Thanks a lot > Luca Bertoncello > ([email protected]) > _______________________________________________ > gdal-dev mailing list > [email protected] > https://lists.osgeo.org/mailman/listinfo/gdal-dev >
_______________________________________________ gdal-dev mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/gdal-dev
