-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
[makevalid] Cutout ring has extra point, causing extra line to be drawn: #70
Comments
The way we determine rings currently is a bit complicated: geom/planar/makevalid/walker/walker.go Lines 335 to 371 in fc18549
However, if we were to change to a different data structure we can find the bridges easier, remove them and have the rings fall out. The new data structure is made up of three elements.
type Node struct {
Point geom.Point
Inbound []*Node
Outbound []*Node
}
var (
index map[geom.Point] struct {
Node *Node
Seen bool
}
smallest geom.Point
) First step is to build out the node graph. This is done by traversing the linestring one point at a time. As we move from point to point we add the point to the map, updating the new point's inbound values and the prior points outbound value. The second step is to iterate through all the nodes, looking at the inbound and outbound to see if there is a common point in both arrays. If there are, these are the bridges. Delete these points. Finally, iterate through all the nodes, starting with the smallest point (this will be the outer ring), Follow the outbound links (there should only be one after eliminating all the bridges). till you get to and end node (a node without any outbound links.). Then follow all the inbound links till you get to a start node (a node without any inbound links). As you walk the nodes mark them as seen in the index. |
This is using the natural_earth water dataset.
Location of error:
http://localhost:8080/?debug=true#13.13/52.75645/173.95104
Polygon In Question
ClipArea:
slippy.NewTile(13,8054,2677).Extent3857().ExpandBy(64.0)
The issue is that one of the "bridges" is remaining in the cutout sliver.
This is an issue in the
PolygonForRing
functionThe text was updated successfully, but these errors were encountered: