Open vtoupet opened 3 years ago
The raster queryset does not support this kind of annotation. To retrieve the pixel value, django-raster has an url endpoint that you can use, see https://django-raster.readthedocs.io/en/stable/algebra.html#pixel-value-lookup.
But I suppose you want to to this server side. For this case the quickest way is probably to identify the RasterTile that intersects with your point, get the tile, and use an internal utility function from django-raster to get the correct pixel.
To get you started, here is the part of the view that selects the RasterTile index https://github.com/geodesign/django-raster/blob/master/raster/views.py#L141 , and here is the utility function to get a pixel value based on a GDALRaster object https://github.com/geodesign/django-raster/blob/master/raster/utils.py#L132
Hope this helps.
Hi,
is there a way to annotate a RasterLayer queryset with pixel value for given coordinates? If not, how would you do to retrieve pixel value for a bunch of RasterLayer in an effective manner?
Thanks.