[gdal-dev] Any trick to run SELECT gdal_get_pixel_value for lots of points?
Rahkonen Jukka
jukka.rahkonen at maanmittauslaitos.fi
Thu Jan 19 11:09:34 PST 2023
Hi,
I tried the new SQL function "gdal_get_pixel_value" from this PR https://github.com/OSGeo/gdal/pull/6877. It is made to query a single point at a time but with some SQL I managed to query a few points with one ogrinfo command. I think that the query works even the
ogrinfo -sql "SELECT gdal_get_pixel_value('P3412A.tif', 1, 'pixel', 100, 200) as p1 UNION SELECT gdal_get_pixel_value('P3412A.tif', 1, 'pixel', 100, 400) as p1 UNION SELECT gdal_get_pixel_value('P3412A.tif', 1, 'pixel', 300, 400) as p1" p3412A.gpkg --config OGR_SQLITE_ALLOW_EXTERNAL_ACCESS YES
INFO: Open of `p3412A.gpkg'
using driver `GPKG' successful.
Layer name: SELECT
Geometry: None
Feature Count: 3
Layer SRS WKT:
(unknown)
p1: Real (0.0)
OGRFeature(SELECT):0
p1 (Real) = 11.1850004196167
OGRFeature(SELECT):1
p1 (Real) = 11.7200002670288
OGRFeature(SELECT):2
p1 (Real) = 13.5690002441406
However, the SQL statement with UNIONs gets too long if user wants to query hundreds or points. Is there any simple trick, SQL based or other, to make such a query?
The ultimate use case would be to find an alternative for the GRASS function v.drape https://grass.osgeo.org/grass82/manuals/v.drape.html.
-Jukka Rahkonen-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230119/09a1374b/attachment.htm>
More information about the gdal-dev
mailing list