<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
span.Shkpostityyli17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 2.0cm 70.85pt 2.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="FI" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US">I tried the new SQL function “gdal_get_pixel_value” from this PR
<a href="https://github.com/OSGeo/gdal/pull/6877">https://github.com/OSGeo/gdal/pull/6877</a>. 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
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">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<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">INFO: Open of `p3412A.gpkg'<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">      using driver `GPKG' successful.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Layer name: SELECT<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Geometry: None<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Feature Count: 3<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Layer SRS WKT:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">(unknown)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">p1: Real (0.0)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">OGRFeature(SELECT):0<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">  p1 (Real) = 11.1850004196167<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">OGRFeature(SELECT):1<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">  p1 (Real) = 11.7200002670288<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">OGRFeature(SELECT):2<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">  p1 (Real) = 13.5690002441406<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">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?<br>
The ultimate use case would be to find an alternative for the GRASS function v.drape
<a href="https://grass.osgeo.org/grass82/manuals/v.drape.html">https://grass.osgeo.org/grass82/manuals/v.drape.html</a>.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">-Jukka Rahkonen-<o:p></o:p></span></p>
</div>
</body>
</html>