Opened 16 years ago
Closed 15 years ago
#2434 closed defect (fixed)
Outer ring detection fails when two rings share exactly one point.
Reported by: | sdlime | Owned by: | sdlime |
---|---|---|---|
Priority: | normal | Milestone: | 5.0.4 release |
Component: | MapServer C Library | Version: | 5.0 |
Severity: | normal | Keywords: | |
Cc: |
Description
The code that detects inner and outer rings is used for converting shapeObj's to GML and GEOS geometries. There is a problem in cases where two rings touch at exactly 1 point (thing two squares touching at a corner). Polygons can touch at 1 point or less. The result is malformed GML output or degenerate GEOS geometries.
The cause is the point-in-polygon method in MapServer. It is degenerate when a point is on the edge of a polygon. It returns 0 or 1 consistently but you don't know if you're on the edge. So, in certain circumstances it's possible to have no outer rings. The outer ring needs to begin and end with a point that is present in another ring. A rare occurrence, but I've found a shapefile with just that case.
The solution is to test 2 points and perhaps 3 when checking for an outer ring. If the first two point-in-polygon tests yield the same result then you know that neither of them are on an edge. If, however, they yield opposite results then one must be on an edge (but you don't know which one). In this case you test a third point and since you know it can't be on an edge (as at most 1 can be).
Steve
Change History (5)
comment:1 by , 16 years ago
Status: | new → assigned |
---|
comment:2 by , 16 years ago
Milestone: | 5.2 release → 5.0 release |
---|
Changing milestone to 5.0 just in case there's another release for that version...
Steve
comment:3 by , 16 years ago
Milestone: | 5.0 release → 5.4 release |
---|
comment:4 by , 16 years ago
Milestone: | 5.4 release → 5.0.4 release |
---|
Should be 5.0.4 release. Already fixed in 5.2 and higher...
Steve
comment:5 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
No more 5.0 releases planned. Closing.
Fixed in the main trunk. I wonder if this should make it's way into the next 5.0 maintenance release?
Steve