[gdal-dev] [EXTERNAL] Re: Is SQLITE dialect supported on Memory OGR datasets?
Even Rouault
even.rouault at spatialys.com
Tue Aug 22 07:43:39 PDT 2023
If the /vsimem/... file hasn't been created, then it won't be opened.
This is like a regular file system
If you want to copy an existing file to /vsimem/, you can do something like
gdal.FileFromMemBuffer("/vsimem/foo.gpkg", open("source.gpkg", "rb").read())
do something
gdal.Unlink("/vsimem/foo.gpkg")
or you can ogr.GetDriverByName(...).CreataDataSource("/vsimem/foo") to
create a new one
Even
Le 22/08/2023 à 16:11, Meyer, Jesse R. (GSFC-618.0)[SCIENCE SYSTEMS AND
APPLICATIONS INC] via gdal-dev a écrit :
>
> As per your workaround suggestion,
>
> Are these intended to work? The returned datasource is None.
> Removing the `/vsimem` preamble returns the disk-backed geopackage
> datasource as expected.
>
> tree_canopy_mem_ds
> =ogr.Open('/vsimem/Users/jrmeyer3/Downloads/features.gpkg')
>
> tree_canopy_mem_ds
> =ogr.GetDriverByName("GPKG").Open('/vsimem/Users/jrmeyer3/Downloads/features.gpkg')
>
> *From: *Even Rouault <even.rouault at spatialys.com>
> *Date: *Monday, August 21, 2023 at 6:22 PM
> *To: *"Meyer, Jesse R. (GSFC-618.0)[SCIENCE SYSTEMS AND APPLICATIONS
> INC]" <jesse.r.meyer at nasa.gov>, "gdal-dev at lists.osgeo.org"
> <gdal-dev at lists.osgeo.org>
> *Subject: *[EXTERNAL] Re: [gdal-dev] Is SQLITE dialect supported on
> Memory OGR datasets?
>
> *CAUTION:*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.
>
>
>
> Jesse,
>
> No it wasn't. Fix in https://github.com/OSGeo/gdal/pull/8247
>
> Potential workaround: use a in-memory SQLite or GeoPackage with a
> /vsimem/ filename
>
> Even
>
> Le 21/08/2023 à 21:30, Meyer, Jesse R. (GSFC-618.0)[SCIENCE SYSTEMS
> AND APPLICATIONS INC] via gdal-dev a écrit :
>
> Hi,
>
> This works:
>
> tc_lyr =execute_SQL(tree_canopy_mem_ds,"select * from
> trees",/spatialFilter/=c_geo)
>
> However, this:
>
> tc_lyr =execute_SQL(tree_canopy_mem_ds,"select * from
> trees",/spatialFilter/=c_geo,/dialect/="SQLITE")
>
> Returns:
>
> In Initialize(): sqlite3_step(SELECT _rowid_, * FROM 'trees' LIMIT
> 1): SQL logic error
>
> Where execute_SQL = ogr.DataSource.ExecuteSQL
>
> Which is naturally a surprise given that I’m not explicitly asking
> for the rowid, nor to limit the number of returned rows.
>
> 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.
>
> My GDAL version install is 3.6.4, on OSX 13.5.
>
> Thanks,
>
> Jesse
>
>
>
> _______________________________________________
>
> gdal-dev mailing list
>
> gdal-dev at lists.osgeo.org
>
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
> --
> http://www.spatialys.com
> My software is free, but my time generally not.
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
--
http://www.spatialys.com
My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230822/a16bd0fc/attachment.htm>
More information about the gdal-dev
mailing list