[gdal-dev] ogr2ogr intersect very slow at command line with large sqlite input

CTL101 chrislloyd2 at yahoo.co.uk
Mon Apr 10 14:51:43 PDT 2017

I've removed the intersection part after realising that I didn't need it as
the intersection geometry is already calculated in the input  (slow hand
clap me!)

So after investigating a bit more I have:
ogr2ogr -gt unlimited -nlt PROMOTE_TO_MULTI25D --config OGR_SQLITE_CACHE
10240 -f SQLite -dsco SPATIALITE=YES output.sqlite input.sqlite -nln
outputtable -dialect sqlite -sql "SELECT A.* FROM inputtable1 A, inputtable2
B WHERE ST_Intersects(A.geometry, B.geometry) AND A.ogc_fid IN (SELECT
A.ogc_fid FROM SpatialIndex WHERE f_table_name = 'inputtable1' AND
search_frame = B.geometry)"

This is now running on the large tables, and still seems really slow. But it
may actually finish this time so who knows. I have looked at the link that
Jukka suggests, and perused the forum but these seem like very complex
programming based solutions to elaborate problems. Surely there is a simple
way to get more speed out of gdal - especially now that the heavy lifting
has been removed almost altogether from my relatively simple query?

View this message in context: http://osgeo-org.1560.x6.nabble.com/ogr2ogr-intersect-very-slow-at-command-line-with-large-sqlite-input-tp5316545p5316746.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.

More information about the gdal-dev mailing list