Skip to main content
Tweeted twitter.com/StackGIS/status/989313165912616961
added 9 characters in body; edited title
Source Link
Ian Turton
  • 84.2k
  • 6
  • 94
  • 190

Spatial indexes in GPKGGeoPackage files

I'm working with GPKGGeoPackage files built with QGIS3. I tried to execute some spatial queries but it was realyreally slow, so I'd like to speed it up with indexes. After

After some readings I tried

create virtual table SpatialIndex using VirtualSpatialIndex(); select * from geosirene where ROWID in ( select ROWID from SpatialIndex where f_table_name = 'geosirene' and f_geometry_column = 'geom' and search_frame = BuildMbr(3807953,2282592,3841940,2314762,3035) ) 

I tested several versions but the 'select rowid from SpatialIndex' always returns an empty set. Every table has its rtree_* . What's wrong ?

Also, I need to use geometries from other table as search_frame , is it possible ?

select b.* from buildings as b, poi_merged as p where intersects(b.geom,p.geom) and b.ROWID in ( select ROWID from SpatialIndex where f_table_name = 'buildings' and f_geometry_column = 'geom' and search_frame = p.geom) ) 

Spatial indexes in GPKG files

I'm working with GPKG files built with QGIS3. I tried to execute some spatial queries but it was realy slow, so I'd like to speed it up with indexes. After some readings I tried

create virtual table SpatialIndex using VirtualSpatialIndex(); select * from geosirene where ROWID in ( select ROWID from SpatialIndex where f_table_name = 'geosirene' and f_geometry_column = 'geom' and search_frame = BuildMbr(3807953,2282592,3841940,2314762,3035) ) 

I tested several versions but the 'select rowid from SpatialIndex' always returns an empty set. Every table has its rtree_* . What's wrong ?

Also, I need to use geometries from other table as search_frame , is it possible ?

select b.* from buildings as b, poi_merged as p where intersects(b.geom,p.geom) and b.ROWID in ( select ROWID from SpatialIndex where f_table_name = 'buildings' and f_geometry_column = 'geom' and search_frame = p.geom) ) 

Spatial indexes in GeoPackage files

I'm working with GeoPackage files built with QGIS3. I tried to execute some spatial queries but it was really slow, so I'd like to speed it up with indexes.

After some readings I tried

create virtual table SpatialIndex using VirtualSpatialIndex(); select * from geosirene where ROWID in ( select ROWID from SpatialIndex where f_table_name = 'geosirene' and f_geometry_column = 'geom' and search_frame = BuildMbr(3807953,2282592,3841940,2314762,3035) ) 

I tested several versions but the 'select rowid from SpatialIndex' always returns an empty set. Every table has its rtree_* . What's wrong ?

Also, I need to use geometries from other table as search_frame , is it possible ?

select b.* from buildings as b, poi_merged as p where intersects(b.geom,p.geom) and b.ROWID in ( select ROWID from SpatialIndex where f_table_name = 'buildings' and f_geometry_column = 'geom' and search_frame = p.geom) ) 
edited tags
Link
PolyGeo
  • 65.5k
  • 29
  • 115
  • 353
added 2 characters in body
Source Link
vidlb
  • 741
  • 1
  • 6
  • 15

Spatial Indexes forindexes in GPKG files

I'm working with GPKG files built bywith QGIS3. I tried to execute some spatial queries but it was realy slow, so I'd like to speed it up with indexes. After some readings I tried

create virtual table SpatialIndex using VirtualSpatialIndex(); select * from geosirene where ROWID in ( select ROWID from SpatialIndex where f_table_name = 'geosirene' and f_geometry_column = 'geom' and search_frame = BuildMbr(3807953,2282592,3841940,2314762,3035) ) 

I tested several versions but the 'select rowid from SpatialIndex' alway returnalways returns an empty set. Every table has its rtree_rtree_* . What's wrong ?

Also, I need to use geometries from other table as a search_frame , is it possible ?

select b.* from buildings as b, poi_merged as p where intersects(b.geom,p.geom) and b.ROWID in ( select ROWID from SpatialIndex where f_table_name = 'buildings' and f_geometry_column = 'geom' and search_frame = p.geom) ) 

Spatial Indexes for GPKG files

I'm working with GPKG files built by QGIS3. I tried to execute some spatial queries but it was realy slow, so I'd like to speed it up with indexes. After some readings I tried

create virtual table SpatialIndex using VirtualSpatialIndex(); select * from geosirene where ROWID in ( select ROWID from SpatialIndex where f_table_name = 'geosirene' and f_geometry_column = 'geom' and search_frame = BuildMbr(3807953,2282592,3841940,2314762,3035) ) 

I tested several versions but the 'select rowid from SpatialIndex' alway return an empty set. Every table has its rtree_. What's wrong ?

Also I need to use geometries from other table as a search_frame , is it possible ?

select b.* from buildings as b, poi_merged as p where intersects(b.geom,p.geom) and b.ROWID in ( select ROWID from SpatialIndex where f_table_name = 'buildings' and f_geometry_column = 'geom' and search_frame = p.geom) ) 

Spatial indexes in GPKG files

I'm working with GPKG files built with QGIS3. I tried to execute some spatial queries but it was realy slow, so I'd like to speed it up with indexes. After some readings I tried

create virtual table SpatialIndex using VirtualSpatialIndex(); select * from geosirene where ROWID in ( select ROWID from SpatialIndex where f_table_name = 'geosirene' and f_geometry_column = 'geom' and search_frame = BuildMbr(3807953,2282592,3841940,2314762,3035) ) 

I tested several versions but the 'select rowid from SpatialIndex' always returns an empty set. Every table has its rtree_* . What's wrong ?

Also, I need to use geometries from other table as search_frame , is it possible ?

select b.* from buildings as b, poi_merged as p where intersects(b.geom,p.geom) and b.ROWID in ( select ROWID from SpatialIndex where f_table_name = 'buildings' and f_geometry_column = 'geom' and search_frame = p.geom) ) 
Source Link
vidlb
  • 741
  • 1
  • 6
  • 15
Loading