What I want to achieve is to extract the raster data within a drawn polygon and parse that information back to the user in the fastest possible way.
For a point dataset it's easy; I just parse the coordinates of the shape to a geoJSON of the points and determine if the points are within the drawn shape.
For a line I use gdallocationinfo. Using the start and end point I can calculate all the intermediate coordinates and query the raster using these coordinates withoud needing to load the geoTIFF in the back-end.
What would be the best way to extract values from a raster using the coordinates of a drawn shape? What I've already tried:
- Converting the geoTIFF to a ascii XYZ file: file is way to large (50gb)
- Classify raster and convert to polygon: a lot of polygons, slow
- Create a hexagon grid and extract values to each hexagon: loss of detail/data
Raster data is rather large: X: 29236 Y: 26458 and consists out of 1 band. The value of that band should be extracted.