-
Notifications
You must be signed in to change notification settings - Fork 230
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
Invalid polygons after clipping at tile boundaries #697
Comments
seems to be the related/same effect as in #580 although i dont have this effect at this zoom level |
Hello all! @geoneutrino It's weird that you had this issue #580 with Athens on November/December 2023, as half year earlier it was working for me #495. @Nakaner If I remember correctly, the discrepancies were because I was using the release of v2.4.0, and not the master branch of github repo directly, which was more updated. @geoneutrino maybe you were using the v2.4.0 release as well? I haven't checked the v3.0.0 as it includes breaking changes and I need to refactor my stuff now 😛. In the meantime, let me include this case, as it breaks my heart seeing the map broken. In Malta (lat: 35.903860, long: 14.503326) at around zoom level 12-13, there's the following issue: @systemed Regarding the shortbread schema, I remember there were some instructions here: Thanks in advance! |
Essentially the only sane way to render river/canal polygons at low zoom levels is to skeletonise them, and that's not something tilemaker can yet do1. I usually drop in Natural Earth shapefiles at these zoom levels which are perfect for this use case. That aside, a significant part of the coastline fix in #611 was to add area filtering to the coastline layer config. Previously, small inners were intersecting with the outers when rescaled to output coordinates, and MBGL really doesn't like self-intersections. Config file area filtering works on the level of individual inners/outers, vs the Lua code you have here which looks at the total area of the multipolygon. So my first suggestion here would be to experiment with area filtering, e.g.
@koufopoulosf -DFLOAT_Z_ORDER is no longer required - tilemaker 3.0 can cope with much wider Z-order values out of the box. Footnotes
|
@systemed Thank you very much for your detailed response. Is there any chance that there is a documentation/guide on how to export the whole globe correctly for production deployments? Also do you suggest export to mbtiles or in pmtiles format for the whole globe? Thanks in advance! |
The intention is that, if you use the latest code with the default OMT-compatible profile/config, it will generate the planet correctly. If you find significant departures from this then please do report them here. If you're using your own profile/config then you will of course have to experiment until you get a pleasing and correct result. 🙂 mbtiles vs pmtiles is really a question of how you want to deploy the tiles, and that's outside tilemaker's scope. Personally I use mbtiles because I have a custom server built around that, but pmtiles is an amazing stack and allows you to go "serverless". |
@systemed That's indeed interesting, but going serverless would make sense for personal projects to me, rather than bigger projects as I am not sure if that would be cost effective at a bigger scale😄. Thanks once again for your support. |
@koufopoulosf i started last year summer with master branch which was basically v2.4 + some commits not affecting clipping stuff as far as i see in comments. I also use the natural earth shapefile as well as an own config/lua, but still with v3 have some effects |
@geoneutrino oh no, that's not good news, I was hoping v3 to have it fixed actually😅 (whole island, in general). So at the end of the day, we agree that we should generate tiles country by country rather than whole globe or whole europe? So that we fix each country individually by every new version of tilemaker?😄 |
Hi everyone! 👋 @systemed, could we please get an update on these issues? I'm currently working on a project where I'm considering setting a maximum zoom level for the map to avoid encountering certain issues. It seems that some of these issues were resolved in previous versions, which makes their persistence a bit perplexing. If these issues persist and can't be resolved, I'd like to know at which zoom level it would be advisable to stop before encountering them. This way, I can ensure a smoother user experience without running into these specific problems. Thank you in advance for your assistance! ✌️ |
Could you confirm whether this happens with the default OMT-compatible schema? |
@systemed I'm using the shortbread schema |
Update: After conducting further testing, it appears that the issue of "missing" land over certain zoom levels may be attributed to how the Lua processing script handles water polygons (shortbread schema related lua). Currently, these polygons overlap significant portions of the land. So probably, it seems that the issue is not directly related to Tilemaker itself. @geoneutrino, have you made any progress in resolving this issue? Update 2: @systemed Upon retesting Greece, I've confirmed that the same issue (#580) persists (coordinates: /#8.7/37.7811/24.4236). Previously, I had resolved this by using the Thanks in advance for your assistance! |
tl;dr - the default profile is optimised to minimise coastline issues. Please use the same config for the ocean layer and report if you still have significant issues. Applying major simplification to very complex shapes is always likely to produce invalid geometries. Taking coastlines designed for z14+ and reducing them to small scales is an example of that. tilemaker jumps through a lot of hoops to minimise invalid geometries but it isn't infallible, and you can improve your chances of success by configuring the layer properly. In particular the default has this:
which dynamically filters out small geometries, e.g. little islands which would shrink down to a few pixels at lower zoom levels. By filtering out these islands you are greatly reducing the chance of self-intersections. For my own purposes I use a different ocean dataset for low zooms. If there is a bug in the default config/profile then please do report it here but I can't undertake to debug every single config/profile created for tilemaker, I'm afraid. Issues specific to shortbread should probably go to the shortbread repo. |
I'm not suggesting anything other than
I'm afraid I'm finding this issue very hard to track because of all the different locations being thrown about, and confusion about what's an issue with shortbread and what's an issue with tilemaker and its default config. It's very possible there's an issue around Athens - I remember encountering problems there before, and indeed #602 was partly tested there. If you can still reproduce a problem using tilemaker's default config, then please do open a Github issue citing that location. Please don't try and generalise it or guess the solution, just report exactly what and where. Thank you! |
While using a fresh new set of Shortbread vector tiles to render a client's style with our Mapnik-GDAL vector-to-raster toolchain, I found huge water polygons across the size of tile on zoom level 6 to 8.
Example (map style rendering only inland water bodies, glaciers and sea):
The affected OSM ways have in common that they cross tile boundaries and, are long and narrow polygons (rivers/canals). The artefacts occur when their narrow "tube" becomes a row of multiple small polygons due to simplification/snapping onto the grid of the vector tiles' internal coordinate system. Examples:
You can use the following example to reproduce the issue:
Filter the planet dump:
Clip the thematic extract:
Run Tilemaker:
tilemaker --input flevoland-water.osm.pbf --output polygon-test.mbtiles --bbox 5.32,52.29,5.92,52.68 --config config-polygon-test.json --process process-polygon-test.lua
(needs about 700 MB RAM and took a few seconds)If you open the resulting vector tile set with QGIS on zoom level 8, you will see a broken polygon like this:
MapLibre GL JS and OpenLayers render the polygon as expected.
tippecanoe-decode
crashes withPolygon begins with an inner ring
.ogr2ogr -f GeoJSON poly.json polygon-test.mbtiles -oo ZOOM_LEVEL=8 -where "osm_id='1187867289'"'" polygon-test.mbtiles
reports following GeoJSON:What does not seem to have any influence:
Using different OSM datasets containing the same features will make different polygons to break. You can reproduce this by skipping the
osmium extract
step and running Tilemaker withplanet-water-polygons.osm.pbf
instead of the Flevoland.osm.pbf
file. While converting GDAL reports a couple of self-intersections and ring self-intersections.The text was updated successfully, but these errors were encountered: