<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=utf-8">
<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;}
@font-face
{font-family:Monaco;
panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Menlo;
panose-1:2 11 6 9 3 8 4 2 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-ligatures:standardcontextual;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
font-size:10.0pt;
font-family:"Courier New";
mso-ligatures:none;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:"Consolas",serif;
mso-ligatures:standardcontextual;}
span.EmailStyle22
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}
@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="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">As per your workaround suggestion,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Are these intended to work? The returned datasource is None. Removing the `/vsimem` preamble returns the disk-backed geopackage datasource as expected.
<o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:Menlo;color:#FCFCFA;mso-ligatures:none"><o:p> </o:p></span></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">tree_canopy_mem_ds
</span><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:#FCFCFA;mso-ligatures:none"> ogr</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">Open</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">/vsimem/Users/jrmeyer3/Downloads/features.gpkg</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"><span style="font-size:9.0pt;font-family:Menlo;color:#FCFCFA;mso-ligatures:none"><o:p> </o:p></span></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">tree_canopy_mem_ds
</span><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:#FCFCFA;mso-ligatures:none"> ogr</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">GetDriverByName</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">GPKG</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">Open</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">/vsimem/Users/jrmeyer3/Downloads/features.gpkg</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"><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>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">Even Rouault <even.rouault@spatialys.com><br>
<b>Date: </b>Monday, August 21, 2023 at 6:22 PM<br>
<b>To: </b>"Meyer, Jesse R. (GSFC-618.0)[SCIENCE SYSTEMS AND APPLICATIONS INC]" <jesse.r.meyer@nasa.gov>, "gdal-dev@lists.osgeo.org" <gdal-dev@lists.osgeo.org><br>
<b>Subject: </b>[EXTERNAL] Re: [gdal-dev] Is SQLITE dialect supported on Memory OGR datasets?</span><span style="font-size:12.0pt;color:black;mso-ligatures:none"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<table class="MsoNormalTable" border="1" cellspacing="0" cellpadding="0" align="left" style="border:solid black 1.5pt">
<tbody>
<tr>
<td width="100%" style="width:100.0%;border:none;background:#FFEB9C;padding:3.75pt 3.75pt 3.75pt 3.75pt">
<p class="MsoNormal" style="mso-element:frame;mso-element-frame-hspace:2.25pt;mso-element-wrap:around;mso-element-anchor-vertical:paragraph;mso-element-anchor-horizontal:column;mso-height-rule:exactly">
<b><span style="font-size:10.0pt;color:black">CAUTION:</span></b><span style="color:black">
</span><span style="font-size:10.0pt;color:black">This email originated from outside of NASA. Please take care when clicking links or opening attachments. Use the "Report Message" button to report suspicious messages to the NASA SOC.</span><span style="color:black">
</span><o:p></o:p></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
<br>
<o:p></o:p></p>
<div>
<p>Jesse,<o:p></o:p></p>
<p>No it wasn't. Fix in <a href="https://github.com/OSGeo/gdal/pull/8247">https://github.com/OSGeo/gdal/pull/8247</a><o:p></o:p></p>
<p>Potential workaround: use a in-memory SQLite or GeoPackage with a /vsimem/ filename<o:p></o:p></p>
<p>Even<o:p></o:p></p>
<div>
<p class="MsoNormal">Le 21/08/2023 à 21:30, Meyer, Jesse R. (GSFC-618.0)[SCIENCE SYSTEMS AND APPLICATIONS INC] via gdal-dev a écrit :<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">This works:<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">tc_lyr
</span><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:#FCFCFA;mso-ligatures:none">
</span><span style="font-size:9.0pt;font-family:Menlo;color:#A9DC76;mso-ligatures:none">execute_SQL</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">tree_canopy_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:#FCFCFA;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">select * from trees</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">spatialFilter</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:#FCFCFA;mso-ligatures:none">c_geo)</span><o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">However, this:<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">tc_lyr
</span><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:#FCFCFA;mso-ligatures:none">
</span><span style="font-size:9.0pt;font-family:Menlo;color:#A9DC76;mso-ligatures:none">execute_SQL</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">tree_canopy_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:#FCFCFA;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">select * from trees</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">spatialFilter</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:#FCFCFA;mso-ligatures:none">c_geo</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><o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Returns:<o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:Monaco;color:#FCFCFA;background:#403E41">In Initialize(): sqlite3_step(SELECT _rowid_, * FROM 'trees' LIMIT 1): SQL logic error</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:Monaco;color:#FCFCFA;background:#403E41"> </span><o:p></o:p></p>
<p class="MsoNormal">Where execute_SQL = ogr.DataSource.ExecuteSQL<o:p></o:p></p>
<p class="MsoNormal">Which is naturally a surprise given that I’m not explicitly asking for the rowid, nor to limit the number of returned rows.<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">The docs claim that the SQLite dialect can be used with any OGR datasource, so I did expect this to work. The input datasource is GeoPackage, which is based on SQLite, so I assume my install is built with SQLite, though I’d welcome advice
on how to explicitly demonstrate this. <o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">My GDAL version install is 3.6.4, on OSX 13.5.<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>
<p class="MsoNormal"><span style="mso-ligatures:none"><br>
<br>
<o:p></o:p></span></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>gdal-dev mailing list<o:p></o:p></pre>
<pre><a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><o:p></o:p></pre>
<pre><a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><o:p></o:p></pre>
</blockquote>
<pre>-- <o:p></o:p></pre>
<pre><a href="http://www.spatialys.com/">http://www.spatialys.com</a><o:p></o:p></pre>
<pre>My software is free, but my time generally not.<o:p></o:p></pre>
</div>
</div>
</body>
</html>