Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jts-dev] Nearest point to a polygon is not contained by its exterior ring when using precission model

There's two ways that I know of to provide the kind of consistency under a fixed precision model that you're looking for:

1) Use a distance tolerance (or perhaps better would be a tolerance square) when evaluating spatial predicates.  In this case that means checking if the point is within the tolerance of an edge of the polygon.  This is fairly simple to do in this simple case, but obviously gets a lot harder if trying to generalize to all geometry types, and/or all spatial relationships.  I'm hoping to develop a new algorithm for spatial relationships that will provide an ability to specify a distance tolerance, but that's still a ways off

2) Snap (or snap-round) all geometries to each other within the fixed-precision realm.  This would introduce a vertex into the polygon if the point is close to an edge, and then the spatial predicates will work as they stand.  The question is how to do the snapping or snap-rounding.  All the machinery is there now with the release of OverlayNG, but there is no API that snaps a set of geometries together.  Perhaps that would be a useful addition.  This has various obvious downsides.  Processing time is one. There is also the question of when to do this, and whether the snapped results should be persisted or not.

The second idea has been a long-standing subject of academic research by Guting in particular.  See [1] for instance.  He has a recent paper out as well [2] - maybe it has some interesting new ideas?  But as far as I know there are no production implementations that follow these ideas.  It may be that they are theoretically elegant but not workable in practice.  

My final thought is that an appropriate solution to this problem really depends on what problem you are trying to solve.  Understanding this requires a broader view of the problem than just that of evaluating a spatial relationship using a tolerance.

[1] https://www.researchgate.net/publication/221471608_Realms_A_Foundation_for_Spatial_Data_Types_in_Database_Systems
[2] https://www.researchgate.net/publication/220387901_Dual_Grid_A_New_Approach_for_Robust_Spatial_Algebra_Implementation



On Fri, Dec 18, 2020 at 4:04 AM Meyer Montagner Murcian <mmontagner@xxxxxxxxxxxxxx> wrote:
Dear JTSers,
I'm faced with a problem and I hoped someone with more experience could lend me a hand. 
I have a point A and a polygon. I need point A to be in the border of the polygon, so I "correct" it using DistanceOp.NearestPoints(). I want to keep this new coordinate as a point for further operations, and as I use a precision model I have to use PrecisionModel.MakePrecise on the coordinate (The type used is FIXED(1000)). The problem is that the new created point is not necessarily aligned with the border of the polygon so polygon.getExteriorRing().covers(correctedPoint) might be false. The same with intersects.
I would like to find a way of respecting the PrecisionModel while being able to validate that the point is in the border of the polygon. Does anyone have any ideas on how I could solve this?
Thanks for your time and help!
Kind regards,
Meyer M
_______________________________________________
jts-dev mailing list
jts-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/jts-dev

Back to the top