Skip to content
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

Add Snap-Rounding Overlay option #2

Open
dr-jts opened this issue May 1, 2018 · 6 comments
Open

Add Snap-Rounding Overlay option #2

dr-jts opened this issue May 1, 2018 · 6 comments

Comments

@dr-jts
Copy link
Owner

dr-jts commented May 1, 2018

Using Snap-Rounding for noding in Overlay should provide full robustness. TopologyExceptions will never be thrown!

Design Aspects

  • For now, the original Overlay algorithm is provided as the default behaviour
  • Snap-rounding is invoked by specifying a noding precision model.
  • Code using Overlay will have to be modified to specify the precision model if it needs to use Snap-Rounding. E.g. CascadedPolygonUnion
  • the entire output geometry is rounded to the specified precision grid. So even segments which are not involved in the overlay will be affected.

Design Issues

  • Should this approach become the default for Overlay?
    • The aggresive rounding might be an issue, however.
    • Likely to be less performant ? (Although it will eliminate the noding validity check)
  • If SR is not the default approach, can it be used to replace the snapping heuristic?
  • How can a suitable noding precision be determined automatically? (Perhaps an interative refinement approach?)

The code is in branch https://github.com/dr-jts/jts/tree/overlay-sr-classic

@dr-jts
Copy link
Owner Author

dr-jts commented May 1, 2018

@strk I'm wondering if the global rounding caused by using SR will be an issue for users? It seems like a small price to pay for robustness, but I can imagine some situations where changing every coordinate might not be desirable.

@dr-jts dr-jts changed the title Add Snap-Rounding Overlay Add Snap-Rounding Overlay option May 1, 2018
@strk
Copy link

strk commented May 2, 2018 via email

@strk
Copy link

strk commented May 7, 2018

@dr-jts so the global rounding issue is that different bodies may opt for different grids and this would result in data passed around to add small changes could result in global coordinates drift to adapt to this or that grid. This is what I'm hearing from govt users. I understand a global govt-driven grid would solve this issue but evidently it is easier to said that done..

@dr-jts
Copy link
Owner Author

dr-jts commented May 7, 2018

@strk That's a good point. However, this should not create issues when using SR for internal computation, as long as the SR grid is finer than all the "external" grids being used. (All that is needed for SR to prevent robustness errors is a few digits of precision, so the grid can be quite fine.)

Another alternative is to use the finest grid of all the ones which will be used (assuming the others are multiples of it).

It's worth noting that snapping to grids itself may introduce topology invalidity (collapses, self-intersection), unless it is done using SR. Is this handled appropriately?

@strk
Copy link

strk commented May 7, 2018 via email

@dr-jts
Copy link
Owner Author

dr-jts commented May 7, 2018

Yes, I've seen this kind of constraint before as well. It's going to be difficult or impossible to provide full robustness while maintaining full precision, I think. Maybe the best that can be done is to not change the coordinates during an overlay op if there is no interaction between the inputs. This will require a special check, though.

And yes, SR should be basically the same impact as precision reduction. At least that's my working hypothesis - will need to be confirmed by testing.

dr-jts added a commit that referenced this issue Jul 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants