<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div style="font-family:Arial;">Hi Robert,<br></div><div style="font-family:Arial;"><br></div><div style="font-family:Arial;">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.<br></div><div style="font-family:Arial;"><br></div><div style="font-family:Arial;">Laurentiu<br></div><div style="font-family:Arial;"><br></div><div>On Wed, Jan 17, 2024, at 12:52, nagyrobi_r--- via gdal-dev wrote:<br></div><blockquote type="cite" id="qt" style=""><div><br></div><div id="qt-ymail_android_signature"><p style="overflow-wrap:break-word;line-height:16.1px;margin-bottom:0.1in;background-color:transparent;background-position-x:0%;background-position-y:0%;background-repeat:repeat;background-attachment:scroll;background-image:none;background-size:auto;background-origin:padding-box;background-clip:border-box;">Hi all!<br></p><p style="overflow-wrap:break-word;line-height:16.1px;margin-bottom:0.1in;background-color:transparent;background-position-x:0%;background-position-y:0%;background-repeat:repeat;background-attachment:scroll;background-image:none;background-size:auto;background-origin:padding-box;background-clip:border-box;">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.<br></p><p style="overflow-wrap:break-word;line-height:16.1px;margin-bottom:0.1in;background-color:transparent;background-position-x:0%;background-position-y:0%;background-repeat:repeat;background-attachment:scroll;background-image:none;background-size:auto;background-origin:padding-box;background-clip:border-box;">I ran this first, and no error<br></p><p style="overflow-wrap:break-word;line-height:16.1px;margin-bottom:0.1in;background-color:transparent;background-position-x:0%;background-position-y:0%;background-repeat:repeat;background-attachment:scroll;background-image:none;background-size:auto;background-origin:padding-box;background-clip:border-box;"><br></p><p style="overflow-wrap:break-word;line-height:16.1px;margin-bottom:0.1in;background-color:transparent;background-position-x:0%;background-position-y:0%;background-repeat:repeat;background-attachment:scroll;background-image:none;background-size:auto;background-origin:padding-box;background-clip:border-box;">ogr2ogr -f "SQLite" /vsimem/temp.sqlite WFS:<a rel="nofollow noopener noreferrer" target="_blank" href="http://localhost:8080/geoserver/wfs" class="qt-yiv3664104468moz-txt-link-rfc2396E" style="overflow-wrap:break-word;word-break:break-word;color:rgb(0, 0, 128);">"http://localhost:8080/geoserver/wfs"</a> ne:buildings -nln buildings -dsco SPATIALITE=YES -lco SPATIAL_INDEX=YES -nlt POLYGON<br></p><p style="overflow-wrap:break-word;line-height:16.1px;margin-bottom:0.1in;background-color:transparent;background-position-x:0%;background-position-y:0%;background-repeat:repeat;background-attachment:scroll;background-image:none;background-size:auto;background-origin:padding-box;background-clip:border-box;">i ran this secondly and no error.<br></p><p style="overflow-wrap:break-word;line-height:16.1px;margin-bottom:0.1in;background-color:transparent;background-position-x:0%;background-position-y:0%;background-repeat:repeat;background-attachment:scroll;background-image:none;background-size:auto;background-origin:padding-box;background-clip:border-box;"><br></p><p style="overflow-wrap:break-word;line-height:16.1px;margin-bottom:0.1in;background-color:transparent;background-position-x:0%;background-position-y:0%;background-repeat:repeat;background-attachment:scroll;background-image:none;background-size:auto;background-origin:padding-box;background-clip:border-box;">ogr2ogr -f "SQLite" -update -append /vsimem/temp.sqlite area_json.json -nln filter -dsco SPATIALITE=YES -lco SPATIAL_INDEX=YES<br></p><p style="overflow-wrap:break-word;line-height:16.1px;margin-bottom:0.1in;background-color:transparent;background-position-x:0%;background-position-y:0%;background-repeat:repeat;background-attachment:scroll;background-image:none;background-size:auto;background-origin:padding-box;background-clip:border-box;">But then i tried: ogrinfo /vsimem/temp.sqlite i get ogrinfo failed - unable to open '/vsimem/temp.sqlite'.<br></p><p style="overflow-wrap:break-word;line-height:16.1px;margin-bottom:0.1in;background-color:transparent;background-position-x:0%;background-position-y:0%;background-repeat:repeat;background-attachment:scroll;background-image:none;background-size:auto;background-origin:padding-box;background-clip:border-box;">And this was what i tried to do further on, but not working due to the reason above.<br></p><p style="overflow-wrap:break-word;line-height:16.1px;margin-bottom:0.1in;background-color:transparent;background-position-x:0%;background-position-y:0%;background-repeat:repeat;background-attachment:scroll;background-image:none;background-size:auto;background-origin:padding-box;background-clip:border-box;"><br></p><pre class="qt-yiv3664104468western" style="overflow-wrap:break-word;background-color:transparent;background-position-x:0%;background-position-y:0%;background-repeat:repeat;background-attachment:scroll;background-image:none;background-size:auto;background-origin:padding-box;background-clip:border-box;font-family:"Liberation Mono", monospace;font-size:10pt;"><code class="qt-yiv3664104468western" style="overflow-wrap:break-word;font-family:"Liberation Mono", monospace;"><span class="font" style="font-family:Liberation Serif, serif;"><span>ogr2ogr PG:"dbname='</span></span></code><code class="qt-yiv3664104468western" style="overflow-wrap:break-word;font-family:"Liberation Mono", monospace;"><span class="font" style="font-family:Liberation Serif, serif;"><span>postgres</span></span></code><code class="qt-yiv3664104468western" style="overflow-wrap:break-word;font-family:"Liberation Mono", monospace;"><span class="font" style="font-family:Liberation Serif, serif;"><span>' host='172.17.0.</span></span></code><code class="qt-yiv3664104468western" style="overflow-wrap:break-word;font-family:"Liberation Mono", monospace;"><span class="font" style="font-family:Liberation Serif, serif;"><span>2</span></span></code><code class="qt-yiv3664104468western" style="overflow-wrap:break-word;font-family:"Liberation Mono", monospace;"><span class="font" style="font-family:Liberation Serif, serif;"><span>' port='5432' user='working_user' password='working_password'" -</span></span></code><code class="qt-yiv3664104468western" style="overflow-wrap:break-word;font-family:"Liberation Mono", monospace;"><span class="font" style="font-family:Liberation Serif, serif;"><span>lco GEOMETRY_NAME=geom</span></span></code><code class="qt-yiv3664104468western" style="overflow-wrap:break-word;font-family:"Liberation Mono", monospace;"><span class="font" style="font-family:Liberation Serif, serif;"><span>
-</span></span></code><code class="qt-yiv3664104468western" style="overflow-wrap:break-word;font-family:"Liberation Mono", monospace;"><span class="font" style="font-family:Liberation Serif, serif;"><span>lco GEOM_TYPE=geometry</span></span></code><code class="qt-yiv3664104468western" style="overflow-wrap:break-word;font-family:"Liberation Mono", monospace;"><span class="font" style="font-family:Liberation Serif, serif;"><span> -lco SCHEMA=geospatial /vsimem/temp.sqlite -sql "Select * from buildings join filter on st_intersects(buildings.geom,filter.geom)" -nln buildings_result -nlt polygon</span></span></code><br></pre><p style="overflow-wrap:break-word;line-height:16.1px;margin-bottom:0.1in;background-color:transparent;background-position-x:0%;background-position-y:0%;background-repeat:repeat;background-attachment:scroll;background-image:none;background-size:auto;background-origin:padding-box;background-clip:border-box;"><br></p><p style="overflow-wrap:break-word;line-height:16.1px;margin-bottom:0.1in;background-color:transparent;background-position-x:0%;background-position-y:0%;background-repeat:repeat;background-attachment:scroll;background-image:none;background-size:auto;background-origin:padding-box;background-clip:border-box;">Any ideas what i am using wrong, or how could i do this properly?<br></p><p style="overflow-wrap:break-word;line-height:16.1px;margin-bottom:0.1in;background-color:transparent;background-position-x:0%;background-position-y:0%;background-repeat:repeat;background-attachment:scroll;background-image:none;background-size:auto;background-origin:padding-box;background-clip:border-box;"><br></p><p style="overflow-wrap:break-word;line-height:16.1px;margin-bottom:0.1in;background-color:transparent;background-position-x:0%;background-position-y:0%;background-repeat:repeat;background-attachment:scroll;background-image:none;background-size:auto;background-origin:padding-box;background-clip:border-box;">Kind regards,<br></p><p style="overflow-wrap:break-word;line-height:16.1px;margin-bottom:0.1in;background-color:transparent;background-position-x:0%;background-position-y:0%;background-repeat:repeat;background-attachment:scroll;background-image:none;background-size:auto;background-origin:padding-box;background-clip:border-box;">Robert N<br></p></div><div>_______________________________________________<br></div><div>gdal-dev mailing list<br></div><div><a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br></div><div><a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></div><div><br></div></blockquote><div style="font-family:Arial;"><br></div></body></html>