<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>If the /vsimem/... file hasn't been created, then it won't be
      opened. This is like a regular file system</p>
    <p>If you want to copy an existing file to /vsimem/, you can do
      something like<br>
    </p>
    <p>gdal.FileFromMemBuffer("/vsimem/foo.gpkg", open("source.gpkg",
      "rb").read())</p>
    <p>do something</p>
    <p>gdal.Unlink("/vsimem/foo.gpkg")</p>
    <p>or you can
      ogr.GetDriverByName(...).CreataDataSource("/vsimem/foo") to create
      a new one</p>
    <p>Even<br>
    </p>
    <div class="moz-cite-prefix">Le 22/08/2023 à 16:11, Meyer, Jesse R.
      (GSFC-618.0)[SCIENCE SYSTEMS AND APPLICATIONS INC] via gdal-dev a
      écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:9790851A-AB47-4613-AB56-20735490C046@ndc.nasa.gov">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style>@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;}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;}div.WordSection1
        {page:WordSection1;}</style>
      <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
              <a class="moz-txt-link-rfc2396E" href="mailto:even.rouault@spatialys.com"><even.rouault@spatialys.com></a><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]" <a class="moz-txt-link-rfc2396E" href="mailto:jesse.r.meyer@nasa.gov"><jesse.r.meyer@nasa.gov></a>,
              <a class="moz-txt-link-rfc2396E" href="mailto:gdal-dev@lists.osgeo.org">"gdal-dev@lists.osgeo.org"</a>
              <a class="moz-txt-link-rfc2396E" href="mailto:gdal-dev@lists.osgeo.org"><gdal-dev@lists.osgeo.org></a><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" style="border:solid black 1.5pt"
          cellspacing="0" cellpadding="0" border="1" align="left">
          <tbody>
            <tr>
              <td
                style="width:100.0%;border:none;background:#FFEB9C;padding:3.75pt
                3.75pt 3.75pt 3.75pt" width="100%">
                <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"
              moz-do-not-send="true" class="moz-txt-link-freetext">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" moz-do-not-send="true" class="moz-txt-link-freetext">gdal-dev@lists.osgeo.org</a><o:p></o:p></pre>
            <pre><a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" moz-do-not-send="true" class="moz-txt-link-freetext">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/" moz-do-not-send="true" class="moz-txt-link-freetext">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>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </body>
</html>