-
Notifications
You must be signed in to change notification settings - Fork 562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
polygon is_simple is wrong #16
Comments
|
It's a tie-bow (self-intersection). See WKT geometry: To visualize: http://dev.openlayers.org/sandbox/docs/examples/wkt.html Sounds like a bug in GEOS for me. |
|
I'm not sure what the intent is in GEOS, but it may be that its simplicity test is not reliable for polygons. Check out this case of a square polygon with a hole occupying all of its lower left quadrant. The rings themselves are simple, but they touch and therefore make an "invalid" polygon:
I'm asking Sandro for clarification. |
|
Looks like a GEOS bug for sure. This is what the OGC Simple Features spec says: "IsSimple ( ): Integer — Returns 1 (TRUE) if this geometric object has no anomalous geometric points, such as self intersection or self tangency. The description of each instantiable geometric class will include the specific conditions that cause an instance of that class to be classified as not simple. The return type is integer, but is interpreted as Boolean, TRUE=1, FALSE=0." The tie-bow self-intersects. |
|
No word yet on geos-devel: http://lists.osgeo.org/pipermail/geos-devel/2012-August/005994.html |
|
I've checked JTS 1.8 too, with Clojure because it has a REPL :) Same situation. |
|
Ah, might as well ask Martin in the JTS list then. |
|
This would seem to be the final word: "Returns true, since by definition LinearRings are always simple." http://www.vividsolutions.com/jts/javadoc/com/vividsolutions/jts/geom/LinearRing.html#isSimple() Rings are always simple, therefore Polygons will always be simple. I'll make sure this is noted in the Shapely manual. |
|
The fact that the operation is being passed to the ring is an implementation detail. A polygon that self intersects is not simple. I tested in ESRI-land and it returns "not simple" correctly. |
|
In all fairness, it is not your bug, it is on JTS :-) |
|
Agreed. I reopened the bug. I think we should break with JTS and GEOS in this case. |
|
Based on this conversation on IRC, it seems it is open to interpretation and it will not be changed http://irclogs.geoapt.com/gdal/%23gdal.2012-09-06.log Just an FYI so you can close the ticket |
|
RBURHUM, what do you do with the results of is_simple? |
|
On an ESRI stack, I usually use it to check for self-intersection of the internal components. On other implementations, nothing, I use isValid() instead. See this ESRI doc http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/IsSimple_Property/002m000003vv000000/ |
|
What I've done for Shapely 1.2.16 is note in the manual that is_simple isn't meaningful for polygons, but i've changed the implementation for the LinearRing class so that in the case of olt's bowtie (above), we get |
|
Makes a lot of sense until/if JTS decides to change their implementation. On Sun, Sep 16, 2012 at 12:18 PM, Sean Gillies notifications@github.comwrote:
|
Refactor functions into separate modules
using version 1.2.14 on ubuntu 12.04/64 bits, and the following points:
pts=[[ 39.14513303, 23.75100816],
[ 97.05372209, 40.54550088],
[ 105.26527014, 48.13302213],
[ 100.91752685, 58.43336815],
[ 71.56081448, 83.55114801],
[ 60.71189168, 86.25316099],
[ 62.00469808, 75.1478176 ],
[ 83.16310007, 42.82071673],
[ 92.82305862, 37.19175582],
[ 95.99401129, 26.47051246],
[ 106.22054482, 15.51975192]]
print Polygon(pts).is_simple
says "True" while it clearly is not:
import pylab
x=map(lambda v:v[0],pts)
y=map(lambda v:v[1],pts)
pylab.plot(x,y)
pylab.plot(x,y,'or')
pylab.show()
The text was updated successfully, but these errors were encountered: