Bug report #5163
points in polygon: does not count points on boundaries
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Processing/QGIS | ||
Affected QGIS version: | 1.7.4 | Regression?: | |
Operating System: | ubuntu 10.04 | Easy fix?: | |
Pull Request or Patch supplied: | No | Resolution: | fixed |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 14915 |
Description
Results from points in polygon
are different than those obtained from R.
Results from qgis are always equal to or lower than
the number calculated by R.
Visual inspection indicates that only points on polygon boundaries
are affected.
In the attached layer quadratsnbpoints
nbp: calculated in R
PNTCNT: calculated by qgis
Associated revisions
also count points that intersects polygon bounds (fix #5163)
also count points that intersects polygon bounds (fix #5163)
History
#1 Updated by cfarmer - over 12 years ago
This is because it isn't programmed to test for intersections :-p The tool checks for containment: It uses QgsGeometry.contains, rather than QgsGeometry.intersects. I suppose intersections would also be perfectly valid, but it is called 'points in polygon' :-p
I don't have a development environment set up at the moment, so can't fix/implement this right away - so will leave this ticket open. Any other developers want a quick fix? Just change line 143 in doPointsInPolygon from " if inGeom.contains(tmpGeom.asPoint()):" to " if inGeom.intersects(tmpGeom):".
Carson
#2 Updated by Alexander Bruy over 12 years ago
- Status changed from Open to Closed
Fixed in changeset 9151fd583b5062a4e085bba70364cd3c0a0c4885.
#3 Updated by Alexander Bruy over 12 years ago
- Resolution set to fixed
#4 Updated by Giovanni Manghi over 12 years ago
- Target version changed from 35 to Version 1.8.0
#5 Updated by Giovanni Manghi over 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.