<div dir="auto">After some thought, you may achieve what you want by resampling the file to a 5km grid size with the Resampling.max option:<div dir="auto"><br></div><div dir="auto"><a href="https://rasterio.readthedocs.io/en/latest/topics/resampling.html">https://rasterio.readthedocs.io/en/latest/topics/resampling.html</a></div><div dir="auto"><br></div><div dir="auto"><a href="https://rasterio.readthedocs.io/en/latest/api/rasterio.enums.html#rasterio.enums.Resampling.max">https://rasterio.readthedocs.io/en/latest/api/rasterio.enums.html#rasterio.enums.Resampling.max</a></div><div dir="auto"><br></div><div dir="auto">You can then store the centroid of the grid cell and the value in a database.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Dec 27, 2021, 1:45 PM Luca Bertoncello <<a href="mailto:lucabert@lucabert.de">lucabert@lucabert.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Am 27.12.2021 um 20:20 schrieb Alan Snow:<br>
<br>
Hi Alan,<br>
<br>
thank you very much for your answer!<br>
<br>
> You may be looking for clip/mask:<br>
><br>
> <a href="https://rasterio.readthedocs.io/en/latest/topics/masking-by-shapefile.html" rel="noreferrer noreferrer" target="_blank">https://rasterio.readthedocs.io/en/latest/topics/masking-by-shapefile.html</a><br>
><br>
> <a href="https://corteva.github.io/rioxarray/stable/examples/clip_geom.html" rel="noreferrer noreferrer" target="_blank">https://corteva.github.io/rioxarray/stable/examples/clip_geom.html</a><br>
><br>
> After clipping, you can use numpy to do the sum.<br>
<br>
As I sayd, I'm really new to GDAL.<br>
I just have these TIFF-files and can't unterstand, from the pages you<br>
linked, how can I split alle these files in little tiles of a given size.<br>
Maybe can you give me an example?<br>
<br>
Thanks a lot<br>
Luca Bertoncello<br>
(<a href="mailto:lucabert@lucabert.de" target="_blank" rel="noreferrer">lucabert@lucabert.de</a>)<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank" rel="noreferrer">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote></div>