-
Notifications
You must be signed in to change notification settings - Fork 432
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
Gaps and overlaps in tiles on high zoom with -zg #562
Comments
This is due to simplification more then likely. If two polygons share an edge and then are simplified in a very slightly different way there is a good change you get output like what you see above. You might try playing with these settings: https://github.com/mapbox/tippecanoe#line-and-polygon-simplification |
thanks @flippmoke I tried -ps and pS but it didn't help, still get the gaps. What value could I use in the --simplification= to have a better scale? |
@jdeboer-geoplan did you try the following?
From the docs: "... detect borders that are shared between multiple polygons and simplify them identically in each polygon." |
Hi @pathmapper yup, that dramatically improved things as you can see in the difference between pic1 and pic2. But there are still gaps |
@jdeboer-geoplan ahh, sorry, I missed that. |
Can you provide a copy of the GeoJSON so I can try to figure out what is going wrong? If you are using |
Absolutely. I'll attache a really cut down copy of my geoJson. One thing I've noticed is that -zg goes higher with less data. e.g |
Thanks for the data. I'll take a look now. |
It does look like the gaps are being introduced during polygon cleanup with Wagyu. I don't see them with cleanup turned off. I think during snap rounding, line segments that pass within a pixel of another edge node are being snapped to that node, which doesn't happen in the other polygon that also shares that line segment as an edge, because the other node is not part of that polygon. |
So maybe the answer is a global snap-rounding pass in which all polygon edges get snapped to the nodes of any other features that they come close to. |
Hi @ericfischer thanks for taking a look, on the -zg thing the geometry was the same, just I'd removed a bunch of them, is that worth raising as a separate issue to these holes from polygon cleanup? |
|
However what this suggests is that what you are looking for is for |
Alternately, an |
Hmm, that doesn't really work, because Wagyu is still doing some amount of insertion of snap-rounded points into your geometries all the way to zoom level 14 (but apparently not in zooms 11 and 12, which is even stranger). |
Even just checking for snap rounding that happens within the tile proper (as opposed to in the buffer), continuing until there is no snapping keeps tiling far too deeply in cases like the Natural Earth countries, which are still doing some snapping at z11. |
wow, this is a can of worms. What snap rounding algo is wagyu using? I assume it's not idempotent? I like the idea of --extend-zooms-if-still-simplifying |
It uses a "hot pixels" approach where two segments that cross through the same pixel get snapped together. It unfortunately is not idempotent, so rerunning it on its own output can produce additional changes. I feel like |
Hi, well I'm learning loads reading up about the exciting array of different snap rounding algos out there, good stuff but not necessarily of any use here. I think that the global snap rounding pass sounds good, that will presumably mean that there maybe more nodes on each polygon and so they might be a little bigger? |
Yes, they'll get bigger because there will be more nodes. I'm actually much more worried about time and memory than about tile size, especially in the future (mapbox/vector-tile-spec#104) when features can be rejoined across tile boundaries, in which case a large polygon will need to be snapped against every feature that it touches in every tile, not just in one. |
I think I'm seeing the same behaviour, and I have a JSON file that reproduces it quite nicely with tippecanoe -P --coalesce-smallest-as-needed --detect-shared-borders --extend-zooms-if-still-dropping -z8 -pw tippecanoe is multiple orders of magnitude faster than our previous tile generator, so time and memory isn't a problem for us yet! :) :) :) |
@ericfischer, is the Wagyu polygon cleanup controlled by a flag? Otherwise can you share how you disabled it so we can work around this in the meantime? |
It is not controlled by a flag because the vector tile spec requires that polygon geometries be valid, and I don't have a way to guarantee that without the use of Wagyu. But if you want to live dangerously, you can comment out the
line here: Line 496 in d64ac19
|
And please note that |
I think (at least in my example) it is unrelated to polygon cleanup then, as disabling it produces almost no difference. Left: without cleanup, Right: with cleanup. |
Interesting. Can you share a sample of your data so I can investigate? |
Attached above - 1800.gz. |
For my reference: the area in question is near 9.5/43.9681/-112.0949. I'm pretty sure the geometric errors are in your original data, which is only given to 3 decimal digits of precision (about 350 feet). If I convert your polygon rings to individual LineStrings and tile them considerably deeper than the display resolution, it is clear that the contours do not match up in many places. If you are not seeing overlaps in mapshaper, it is because it is drawing the shapes opaquely rather than with partial transparency, which hides the overlaps. I think whatever process is creating these polygons is doing its own line simplification, and that to get the results you want you will need to stop it from simplifying or get it to use a higher precision during simplification. |
You were right - there was some line simplification going on in the geojson library generating it. |
So ive done what @ericfischer suggested but im getting a "found unexpected character" error when trying to merge the two mbtiles
My vector tile at high zoom level is pixalated and wanting to merge two vector tiles to remedy that. What do you suggest to resolve the error? |
Hi, I've got a small problem with the -zg option, there might be a flag option I'm missing that would sort it out. When I run with -zg it guesses that I want to go down to z8
Choosing a maxzoom of -z6 for features about 5147 feet (1569 meters) apart
Choosing a maxzoom of -z8 for resolution of about 1281 feet (390 meters) within features
However when I zoom in to level 14 it has lots of holes and overlaps, if I generate it to level 14 it looks fine all the way to 20.
Output
If I use -ab the results are much better but still not perfect:
Output
I'd hoped -pS might help but although the tile file is slightly bigger I can't see any difference in output.
I can provide the geoJSON but I feel this must be a known problem and I'm just failing to find the right flag combo to sort it out. Obviously I can get my tiles by generating all the way to z14 but I'm attracted to the much faster creation and smaller tile file size of only going to z8 if that's possible with my data.
Thanks
The text was updated successfully, but these errors were encountered: