[gdal-dev] Using VSIMEM properly
Laurențiu Nicola
lnicola at dend.ro
Wed Jan 17 02:59:02 PST 2024
Hi Robert,
The contents of /vsimem/ is only stored in memory and goes away when your application quits. You should use a real file instead, or something like a Python script that calls gdal.VectorTranslate.
Laurentiu
On Wed, Jan 17, 2024, at 12:52, nagyrobi_r--- via gdal-dev wrote:
>
> Hi all!
>
> Maybe i am not using this tool properly. I am want to read the contents of a WFS service into an in memory sqlite database. Then i want to add a second table to it name it filter from a geojson, do an SQL query on the two tables, and write the result into a Postgresql database, this only using command line tools.
>
> I ran this first, and no error
>
>
>
> ogr2ogr -f "SQLite" /vsimem/temp.sqlite WFS:"http://localhost:8080/geoserver/wfs" ne:buildings -nln buildings -dsco SPATIALITE=YES -lco SPATIAL_INDEX=YES -nlt POLYGON
>
> i ran this secondly and no error.
>
>
>
> ogr2ogr -f "SQLite" -update -append /vsimem/temp.sqlite area_json.json -nln filter -dsco SPATIALITE=YES -lco SPATIAL_INDEX=YES
>
> But then i tried: ogrinfo /vsimem/temp.sqlite i get ogrinfo failed - unable to open '/vsimem/temp.sqlite'.
>
> And this was what i tried to do further on, but not working due to the reason above.
>
>
>
> `ogr2ogr PG:"dbname='``postgres``' host='172.17.0.``2``' port='5432' user='working_user' password='working_password'" -``lco GEOMETRY_NAME=geom``
> -``lco GEOM_TYPE=geometry`` -lco SCHEMA=geospatial /vsimem/temp.sqlite -sql "Select * from buildings join filter on st_intersects(buildings.geom,filter.geom)" -nln buildings_result -nlt polygon`
>
>
> Any ideas what i am using wrong, or how could i do this properly?
>
>
>
> Kind regards,
>
> Robert N
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20240117/0a281d7a/attachment.htm>
More information about the gdal-dev
mailing list