[gdal-dev] SQL / gdal_get_pixel_value tips requested

Meyer, Jesse R. (GSFC-618.0)[SCIENCE SYSTEMS AND APPLICATIONS INC] jesse.r.meyer at nasa.gov
Wed May 8 10:09:17 PDT 2024


Hi,

I’m wanting to execute a SQL query on a vector database like:
vector_mem_ds.ExecuteSQL(f"select ST_Centroid(GEOMETRY) as cnt, gdal_get_pixel_value('{raster_fp}', {ndvi_band_num}, 'georef', cnt.STX, cnt.STY) from ds", dialect="SQLITE")

In particular, I want to use the geometry’s centroid for gdal_get_pixel_value, but the latter function takes two parameters, and ST_Centroid provides 1 return value (a compound type Point), so I am hoping for some way to unpack this into the form necessary expected from get_pixel_value.  Apparently some GIS query engines do expose a STX and STY field but that’s if you trust random google results.  But as is this fails.

Is this possible largely as-is?

Thanks,
Jesse
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20240508/316ef00b/attachment-0001.htm>


More information about the gdal-dev mailing list