Bug report #9242

spatial query not giving all matches

Added by arturo emiliano melchiori over 10 years ago. Updated over 10 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Python plugins
Affected QGIS version:2.0.1 Regression?:No
Operating System:Linux Ubuntu Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:17860

Description

I am using the spatial query to select all features in a layer that "touches" another feature in another layer. As it can be seen in the picture attached, not all features are selected. Many features are not been selected, I am just showing one. With several files it is doing the same thing. One file is obtained from the other by a difference operation, so they are actually touching features. What can be wrong?

spatialquery.jpg (115 KB) arturo emiliano melchiori, 2013-12-20 09:56 AM

referencia.prj (397 Bytes) arturo emiliano melchiori, 2013-12-20 10:29 AM

referencia.shp (780 Bytes) arturo emiliano melchiori, 2013-12-20 10:29 AM

referencia.shx (108 Bytes) arturo emiliano melchiori, 2013-12-20 10:29 AM

omiss.dbf (285 Bytes) arturo emiliano melchiori, 2013-12-20 10:29 AM

omiss.prj (397 Bytes) arturo emiliano melchiori, 2013-12-20 10:29 AM

omiss.shp (1.13 KB) arturo emiliano melchiori, 2013-12-20 10:29 AM

omiss.shx (132 Bytes) arturo emiliano melchiori, 2013-12-20 10:29 AM

referencia.dbf (168 Bytes) arturo emiliano melchiori, 2013-12-20 10:29 AM

clean.tar.gz (1020 Bytes) Giovanni Manghi, 2013-12-25 11:51 PM

History

#1 Updated by arturo emiliano melchiori over 10 years ago

Here's a sample of the layers I am operating. If I try the spatial query selecting all features in "Omiss" that touch the "referencia" there are some of them that are excluded from the result.

#2 Updated by Jukka Rahkonen over 10 years ago

I had a try with OpenJUMP and result was the same. There seems to be a topolygy error in a feature on the "omiss" layer. There is a ring self-intersection at point (257889.83459895354 8888074.88550037). I suggest to repeat the test after checking and correcting the topological errors. Here is the WKT of the invalid multipolygon in the omiss.shp

MULTIPOLYGON (((
257859.83396876074 8888104.886263603,
257889.83459895354 8888104.886263603,
257889.83459895354 8888074.88550037,
257919.83522914632 8888074.88550037,
257919.83522914632 8888044.884737134,
257949.8358593391 8888044.884737134,
257949.8358593391 8888014.883973898,
258009.83711972472 8888014.883973898,
258009.83711972472 8887984.883210665,
257979.8364895319 8887984.883210665,
257919.83522914632 8887984.883210665,
257919.83522914632 8888014.883973898,
257859.83396876074 8888014.883973898,
257859.83396876074 8888044.884737134,
257889.83459895354 8888044.884737134,
257889.83459895354 8888074.88550037,
257859.83396876074 8888074.88550037,
257859.83396876074 8888104.886263603
)), ((
258009.83711972472 8887984.883210665,
258039.8377499175 8887984.883210665,
258069.83838011028 8887984.883210665,
258069.83838011028 8888044.884737134,
258099.83901030308 8888044.884737134,
258099.83901030308 8887954.882447429,
258069.83838011028 8887954.882447429,
258009.83711972472 8887954.882447429,
258009.83711972472 8887984.883210665
)))

#3 Updated by Giovanni Manghi over 10 years ago

  • Resolution set to invalid
  • Status changed from Open to Closed
  • File clean.tar.gz added

There is also an error in the "referencia" layer that seems to be the source of the problem, as once fixed (see attached layer) the operation works ok.

#4 Updated by arturo emiliano melchiori over 10 years ago

The problem comes from the gdal.polygonize function with the 8CONNECTED=8 option set. Both layers are build from rasters with that function. Sorry from blaming QGIS.

Also available in: Atom PDF