Bug report #5264

Spatialite Provider / fTools Select by Location does not find intersections

Added by Liam Veitch about 12 years ago. Updated about 7 years ago.

Affected QGIS version:master Regression?:
Operating System:all Easy fix?:
Pull Request or Patch supplied:No Resolution:fixed
Crashes QGIS or corrupts data:No Copied to github as #:14995


fTools 'Select by Location' tool does not find intersecting geometry when using a Spatialite Layer.

Tested working fine with ESRI Shapefile and MYSQL layers.

Spatialite_fTools_Bug.zip - Project with Test Spatialite DB and identical Shapefiles (272 KB) Liam Veitch, 2012-03-31 04:15 AM

Associated revisions

Revision 0b8e1130
Added by Alexander Bruy about 12 years ago

SpatiaLite support in Select by Location tool (fix #5264)


#1 Updated by Liam Veitch about 12 years ago

I've uploaded a project for others to test.

#2 Updated by Alexander Bruy about 12 years ago

  • OS version deleted (XP)
  • Priority changed from Normal to High
  • Target version changed from Version 1.7.4 to Version 1.8.0
  • Operating System changed from Windows to all

Seems this is common problem for all fTools and SpatiaLite layers. See also #4571

#3 Updated by Sandro Furieri about 12 years ago

Just tested on pure SpatiaLite:

SELECT pg.pkuid, pt.pkuid
FROM Polygons AS pg, points AS pt
WHERE ST_Intersects(pg.geometry, pt.geometry) = 1;

the above query works nicely on behalf of the DB file
included in Spatialite_fTools_Bug.zip

Anyway, as far as I can see, fTools doesn't uses the
internal Spatial capabilities supplied by SpatiaLite;
it's a Python process attempting to retrieve "raw"
features supplied by the underlying QGIS data provider,
then calling GEOS so to perform actual spatial processing
(exactly the same as internally managed by SpatiaLite's
own Spatial SQL functions).

So standing things, I can only suppose that:
a) fTools apply some wrong assumption about geometries/features
returned by the SpatiaLite data provider
b) alternatively, the data provider itself returns badly
formatted features (this seeming less probable, because only
fTools apparently seems to get problems when processing SpatiaLite
data: AFAIK any other QGIS module works exactly as expected)

I'm not a Python developer and fTools code is rather complex:
sorry, but I'm completely unable to go in further depth.
Anyway I hope that the above considerations could be useful
for some other developer interested in this topic.

#4 Updated by Giovanni Manghi about 12 years ago

see also #4571

#5 Updated by Alexander Bruy about 12 years ago

  • Status changed from Open to Closed

#6 Updated by Alexander Bruy about 12 years ago

  • Resolution set to fixed

#7 Updated by Alexander Bruy about 12 years ago

BTW, this tool duplicates SpatialQuery plugin functionality and probably should be removed

#8 Updated by Giovanni Manghi about 7 years ago

The "ftools" category is being removed from the tracker, changing the category of this ticket to "Processing/QGIS" to not leave the category orphaned.

Also available in: Atom PDF