Recently I noticed that I find the tilestats section of the metadata.json slightly surprising.
Short summary: I created a GeoJSON file with 3 geometries: a point, a line, and a polygon. I processed it using tippecanoe (creating both an mbtiles file and a directory tree of pbf files). All 3 input geometries show up in QGIS when the mbtiles file is loaded. However, the tilestats section of metadata.json only mentions Point as geometry.
Steps to reproduce the issue
Create example GeoJSON file:
#!/usr/bin/python3
import geopandas as gpd
import shapely.geometry
point = shapely.geometry.Point(12, 34)
linestring = shapely.geometry.LineString([[10,20],[-30,40]])
polygon = shapely.geometry.Polygon([[0,0],[0,10],[10,10],[0,0]])
gpd.GeoSeries([point,linestring,polygon]).set_crs(4326).to_file("example.geojson")
It's nice that we have "count": 3 (we started with 3 features). However, why do we have "geometry": "Point"?
I think it would be nice to have ["Point","LineString","Polygon"] instead, for example. Or some other value which enables users to know that not only Point geometries where used to create the tiles. Alternatively, I think an option forcing tippecanoe to fail if tilestats doesn't accurately represent input geometries (perhaps --be-strict-with-tilestats?) would be very useful.
Thanks for sharing some insights on the matter :) Tippecanoe is awesome, thanks a lot for developing it.
Recently I noticed that I find the tilestats section of the metadata.json slightly surprising.
Short summary: I created a GeoJSON file with 3 geometries: a point, a line, and a polygon. I processed it using tippecanoe (creating both an mbtiles file and a directory tree of pbf files). All 3 input geometries show up in QGIS when the mbtiles file is loaded. However, the tilestats section of metadata.json only mentions
Point
as geometry.Steps to reproduce the issue
Create example GeoJSON file:
Tile data to an mbtiles file:
tippecanoe -Z2 -z10 -o out.mbtiles example.geojson
Tile data to a directory tree:
tippecanoe -Z2 -z10 -e out example.geojson
Open mbtiles file in QGIS:
Features show up as expected. Inspect the tilestats section of
metadata.json
:cat out/metadata.json | jq '.json' | jq -c '. | fromjson' | jq '.tilestats'
Get:
It's nice that we have
"count": 3
(we started with 3 features). However, why do we have"geometry": "Point"
?I think it would be nice to have
["Point","LineString","Polygon"]
instead, for example. Or some other value which enables users to know that not only Point geometries where used to create the tiles. Alternatively, I think an option forcing tippecanoe to fail iftilestats
doesn't accurately represent input geometries (perhaps--be-strict-with-tilestats
?) would be very useful.Thanks for sharing some insights on the matter :) Tippecanoe is awesome, thanks a lot for developing it.