Closed Niklas81 closed 1 year ago
Could you attach the ne_10m_admin_0_countries_lakes_tesselated.json
file so I can see what is going on?
If only one polygon from a multipolygon is surviving in the output, that makes me suspect that your coordinates
array is nested wrong, and you have specified the geometries as the rings of a polygon (the first of which is always the outer ring in GeoJSON; the others are inner rings) rather as than the polygons of a multipolygon.
I've looked through each generated polygon for the US, and none of them is the original polygon (before splitting). Or perhaps you meant something else? I've now also tried to round off coordinates with potentially an excessive amount of decimals, in case that might be the issue. Tried reducing them to 13 and even 10 decimals, but this changes noting either.
I've uploaded ne_10m_admin_0_countries_lakes_tesselated.json
to here:
https://ufile.io/n359pus8
Please let me know I you prefer another delivery method; Github didn't allow me to paste a json file.
Maybe I explained myself badly, but the problem really does seems to be that your intended polygons are represented as the rings (outer followed by inner) of a polygon rather than as individual polygons of a multipolygon.
Here is a script to fix them and the result. I think they look OK afterward, aside from a couple of simplification artifacts between the subdivisions.
Ok, thanks! I did indeed generate the wrong type of json structure. However, now when I've fixed this part and generate tiles from a correct geoJson, it seems that tippecanoe tries to merge polygons into as large ones as possible. This produces once again the same result my original (before splitting the polygons); with the edges of large polygons "shining through" the globe. But, replacing all MultiPolygons with many Polygons fixes this. Still needs some fine-tuning, but overall this fixed this particular issue.
That merging of directly adjacent polygons of a multipolygon is a requirement of the vector tile format, which requires polygon geometries to be "simple." If you want them to remain distinct, you will have to represent them as separate features.
I'm trying to generate an
.mbtiles
file from geoJson data. I'm using data from naturalearthdata, specifically ne_10m_admin_0_countries_lakes. If I use this data directly, I can generate an mbtiles file that seem to include all polygons. However, large flat polygons projected onto a spherical surface cases the problem described here:https://github.com/mousebird-consulting-inc/WhirlyGlobe/issues/1173
To alleviate this, I'm splitting polygons that represent areas larger than 270.000 km^2 into smaller ones using a python script, generating a new geojson file which I use as input for tippecanoe. This involves generating a shapefile for each feature and passing it through QGIS, then converting it back to geojson. For example, the MultiPolygon representing the US excluding Alaska, becomes this array of polygons:
But when making an mbtiles with this as input, it seems all but the smallest polygon in each feature's MultiPolygon is dropped, producing a world map that looks like this when focused over Europe:
To verify that it isn't my generated dataset that is corrupt, I have tried to omitt adding the non-modified polygons to the geojson file used as input to tippeconoe, but I get the same result (only of course with fewer polygons). I've also tried adding each polygon from the
MultiPolygon
s as an individual feature with instead a singlePolygon
(using 5215 features instead of 255), but this doesn't help either.I've tried a multitude of different commands, but to no avail. Here is one of them:
tippecanoe -s EPSG:4326 --no-tile-compression --no-feature-limit --no-tile-size-limit --coalesce-fraction-as-needed --coalesce-densest-as-needed -o newtest.mbtiles -zg -l countries -n "countries" ne_10m_admin_0_countries_lakes_tesselated.json
Any idea what's going and how to fix this? Your help would be much appreciated!