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
getInteriorPoint does not intersect narrow polygon #359
Comments
Well, yes... that's a pretty narrow polygon. 2.8E-16 width, in fact. Have to think about what to do about this... This might be solvable by a better intersection computation (i.e. using extended precision). Although, there is a public warning in the FAQ about this kind of thing: https://locationtech.github.io/jts/jts-faq.html#D7 Side note: I intend to improve the PointInArea computation using this code in the TestBuilder. The reason is to avoid calling Geometry.intersection(), which is expensive and non-robust. That would be a good time to look at this problem. |
Really this is more of a "finite-precision" issue than an actual robustness failure. There are just some limitations to working in finite-precision floating point which cannot be worked around. Perhaps the best that can be done at some point is to implement a tolerance/precision model for predicate calculations (which is the to-do list, and seems tractable). |
Perhaps the simplest thing to do is to detect that the computed interior point does not intersect the polygon, and simply return a vertex of the polygon. This is not ideal, but may improve the outcome of some use cases (or then again, it may make them worse - hard to know without some real-world experience). In fact I'm about to land an improved InteriorPointArea which has this behaviour (#369). So perhaps this will provide some feedback. |
Possibly fixed by #369 |
An interior point generated from the following polygon is not found to intersect the polygon.
POLYGON ((2.0875049999999997 49.038467, 2.087497642793396 49.0384427212182, 2.087475 49.038368, 2.0875049999999997 49.038467))
As reported in https://trac.osgeo.org/postgis/ticket/4274
The text was updated successfully, but these errors were encountered: