-
Notifications
You must be signed in to change notification settings - Fork 5
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
Switch to martinez clipper #2
Conversation
(closes #1)
@bhousel Are there tweaks we could make to the data to work around the martinez bugs? Things to avoid? I'd be happy to sacrifice some space efficiency in order to drop JSTS. |
I don't think so.. We can probably always invent situations where the country coder geometries will intersect this way. It looks like w8r/martinez#115 didn't actually merge yet, and there are some related issues in the comment thread that it would also fix, so I wonder if I could spend time on that to finish it up.. |
I dug in a bit more today and learned a few things. The clipping might be ok. The rendering artifacts are probably caused by a mapbox-gl / earcut issue The This is the "Southern Europe + Northern Africa" example: The region around the Canary Islands does this: But it looks fine on https://geojson.io: So I reduced it to this simpler test case: {
"type": "Feature",
"properties": {},
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[-15, 40],
[-15.92339, 29.50503],
[-8, 32],
[-7.37282, 36.96896],
[-15.92339, 29.50503],
[-25.3475, 27.87574],
[-17.27295, 21.93519],
[5.14112, 40],
[-15, 40]
]
]
]
}
} Geojson.io:Mapbox GL 1.8:Some more things I want to try
|
(testing, may revert later)
ok it's definitely a bad clipping result and not the result of improper winding. Going to also check out this other alternative library: https://github.com/mfogel/polygon-clipping |
superseded by #20 |
Ok, so this is promising. It's fast and small, but I am running into some of the unioning issues reported in the martinez repo:
JSTS/Turf
Martinez
I have a feeling w8r/martinez#115 might fix this, so I'm going to leave this work on a branch and wait for martinez to get an update. It's great to see that there is active work being done!