-
Notifications
You must be signed in to change notification settings - Fork 117
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
Fix invalid polygon geometries (intersecting & colinear segments) #53
Comments
Thanks, yes, this needs revisited. We are using only AGG-based clipping still which - by design - leads to the edges you see. Not a blocker if the tile is slightly buffered and they can be discarded out of sight but yes, certainly not ideal for the reasons you detail. The intended plan early on was to use Clipper or Boost.Geometry but we ran into blocking hangs and crashing bugs, respectively. However both toolkits have had a number of releases since so hopefully we can move to Clipper or Boost.Geometry in upcoming releases. |
Awesome, looking forward to it! |
@springmeyer btw, any idea of when you might try to approach this? Just wondering if it's worth spending a lot of effort trying to get around the degeneracies on the JS side, or would it be much easier to fix that on the VT side. |
@mourner - Definitely seems ideal to fix on the generation side. That said ideally i'd take a closer look at this not till end of sept/early oct - given other things in the pipeline. |
@springmeyer I was directed to this issue from the mapbox/vector-tile-js#14 issue. Is there any update? |
@mpickell high on the list of priorities so this will get attention soon, but I don't have an ETA yet. |
Update here: degenerate edgesWe have a plan to fix degenerate edges which is to move away from the agg clipper to a better clipping library (The AGG clipper leaves degenerate edges by design). Since we need to support complex/potentially non-simple and self-intersecting polygons we cannot use To mitigate the performance hit of this new clipper, the plan is to simplify before clipping. To simplify before clipping the plan is to use invalid polygonsPolygons with degenerate/colinear eges or self-intersections before they arrive to Mapnik are going to be much harder to fix. My understand from talking with @mourner is that the latest earcut library (that we are targeting) is able to handle a variety of self-intersections. But we can consider using clipper In the meantime anyone that has small testcases of invalid polygons you think should still be supported, please share them in the form of GeoJSON files. |
Done with VT2 |
Clipping and simplification of polygon geometries often makes the polygons non-simple (with intersecting & touching segments). This is hard to handle when trying to tesselate such polygons for rendering (both on native & JS). Native uses Clipper (specifically SimplifyPolygon with StrictlySimple) to fix the geometries. It has a port for JS, but applying it there would take a lot of precious CPU time, so it would be great to fix those problems on the VT side, using Clipper there.
Intersecting edges after simplification:

Degenerate edges after clipping:

cc @springmeyer @yhahn
The text was updated successfully, but these errors were encountered: