1

I'm struggling with the following; I am setting up a web mapping environment using Leaflet. In the front end I use Javascript and the back-end is build with Python. When clicking or drawing an shape on the map I get the lat-lng coordinates back.

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.