<html 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=Windows-1252">
<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:Aptos;
panose-1:2 11 0 4 2 2 2 2 2 4;}
@font-face
{font-family:Menlo;
panose-1:2 11 6 9 3 8 4 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Aptos",sans-serif;
mso-ligatures:standardcontextual;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Aptos",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:11.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="#467886" vlink="#96607D" 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">I’m wanting to execute a SQL query on a vector database like:<o:p></o:p></p>
<p class="MsoNormal" style="line-height:13.5pt;background:#2D2A2E"><span style="font-size:9.0pt;font-family:Menlo;color:#FCFCFA;mso-ligatures:none">vector_mem_ds</span><span style="font-size:9.0pt;font-family:Menlo;color:#939293;mso-ligatures:none">.</span><span style="font-size:9.0pt;font-family:Menlo;color:#A9DC76;mso-ligatures:none">ExecuteSQL</span><span style="font-size:9.0pt;font-family:Menlo;color:#939293;mso-ligatures:none">(</span><i><span style="font-size:9.0pt;font-family:Menlo;color:#78DCE8;mso-ligatures:none">f</span></i><span style="font-size:9.0pt;font-family:Menlo;color:#FFD866;mso-ligatures:none">"select
ST_Centroid(GEOMETRY) as cnt, gdal_get_pixel_value('</span><span style="font-size:9.0pt;font-family:Menlo;color:#AB9DF2;mso-ligatures:none">{</span><span style="font-size:9.0pt;font-family:Menlo;color:#FCFCFA;mso-ligatures:none">raster_fp</span><span style="font-size:9.0pt;font-family:Menlo;color:#AB9DF2;mso-ligatures:none">}</span><span style="font-size:9.0pt;font-family:Menlo;color:#FFD866;mso-ligatures:none">',
</span><span style="font-size:9.0pt;font-family:Menlo;color:#AB9DF2;mso-ligatures:none">{</span><span style="font-size:9.0pt;font-family:Menlo;color:#FCFCFA;mso-ligatures:none">ndvi_band_num</span><span style="font-size:9.0pt;font-family:Menlo;color:#AB9DF2;mso-ligatures:none">}</span><span style="font-size:9.0pt;font-family:Menlo;color:#FFD866;mso-ligatures:none">,
'georef', cnt.STX, cnt.STY) from ds"</span><span style="font-size:9.0pt;font-family:Menlo;color:#939293;mso-ligatures:none">,</span><span style="font-size:9.0pt;font-family:Menlo;color:#FCFCFA;mso-ligatures:none">
</span><i><span style="font-size:9.0pt;font-family:Menlo;color:#FC9867;mso-ligatures:none">dialect</span></i><span style="font-size:9.0pt;font-family:Menlo;color:#FF6188;mso-ligatures:none">=</span><span style="font-size:9.0pt;font-family:Menlo;color:#939293;mso-ligatures:none">"</span><span style="font-size:9.0pt;font-family:Menlo;color:#FFD866;mso-ligatures:none">SQLITE</span><span style="font-size:9.0pt;font-family:Menlo;color:#939293;mso-ligatures:none">")</span><span style="font-size:9.0pt;font-family:Menlo;color:#FCFCFA;mso-ligatures:none"><o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Is this possible largely as-is?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal">Jesse<o:p></o:p></p>
</div>
</body>
</html>