unvt / kata

A vector tile design information processing tool
MIT License
17 stars 2 forks source link

`kata document` doesn't get the correct zoom levels if the tile was built from ndjson #11

Open miya0001 opened 2 years ago

miya0001 commented 2 years ago

I created a ndjson as test.ndjson:

{ "type": "Feature", "properties": {}, "geometry": { "type": "Point", "coordinates": [ 0, 0 ] }, "tippecanoe": { "layer": "layer1", "minzoom": 0, "maxzoom": 0 } }
{ "type": "Feature", "properties": {}, "geometry": { "type": "Point", "coordinates": [ 1, 1 ] }, "tippecanoe": { "layer": "layer2", "minzoom": 1, "maxzoom": 1 } }
{ "type": "Feature", "properties": {}, "geometry": { "type": "Point", "coordinates": [ 2, 2 ] }, "tippecanoe": { "layer": "layer3", "minzoom": 2, "maxzoom": 2 } }
{ "type": "Feature", "properties": {}, "geometry": { "type": "Point", "coordinates": [ 3, 3 ] }, "tippecanoe": { "layer": "layer4", "minzoom": 3, "maxzoom": 3 } }
{ "type": "Feature", "properties": {}, "geometry": { "type": "Point", "coordinates": [ 4, 4 ] }, "tippecanoe": { "layer": "layer5", "minzoom": 4, "maxzoom": 4 } }
{ "type": "Feature", "properties": {}, "geometry": { "type": "Point", "coordinates": [ 5, 5 ] }, "tippecanoe": { "layer": "layer6", "minzoom": 5, "maxzoom": 5 } }
{ "type": "Feature", "properties": {}, "geometry": { "type": "Point", "coordinates": [ 6, 6 ] }, "tippecanoe": { "layer": "layer7", "minzoom": 6, "maxzoom": 6 } }

Then run tippecanoe:

$ tippecanoe -o test.mbtiles test.ndjson

We can see tiles in zoom level 0-6 only. But the test.mbtiles has metadatas as zoom level 0-14 like following.

$ sqlite3 test.mbtiles
SQLite version 3.36.0 2021-06-18 18:58:49
Enter ".help" for usage hints.
sqlite> select * from metadata;
name|test.mbtiles
description|test.mbtiles
version|2
minzoom|0
maxzoom|14
center|0.000000,6.000000,14
bounds|0.000000,0.000000,6.000000,6.000000
type|overlay
format|pbf
generator|tippecanoe v1.36.0
generator_options|tippecanoe -o test.mbtiles test.ndjson
json|{"vector_layers": [ { "id": "layer1", "description": "", "minzoom": 0, "maxzoom": 14, "fields": {} }, { "id": "layer2", "description": "", "minzoom": 0, "maxzoom": 14, "fields": {} }, { "id": "layer3", "description": "", "minzoom": 0, "maxzoom": 14, "fields": {} }, { "id": "layer4", "description": "", "minzoom": 0, "maxzoom": 14, "fields": {} }, { "id": "layer5", "description": "", "minzoom": 0, "maxzoom": 14, "fields": {} }, { "id": "layer6", "description": "", "minzoom": 0, "maxzoom": 14, "fields": {} }, { "id": "layer7", "description": "", "minzoom": 0, "maxzoom": 14, "fields": {} } ],"tilestats": {"layerCount": 7,"layers": [{"layer": "layer1","count": 1,"geometry": "Point","attributeCount": 0,"attributes": []},{"layer": "layer2","count": 1,"geometry": "Point","attributeCount": 0,"attributes": []},{"layer": "layer3","count": 1,"geometry": "Point","attributeCount": 0,"attributes": []},{"layer": "layer4","count": 1,"geometry": "Point","attributeCount": 0,"attributes": []},{"layer": "layer5","count": 1,"geometry": "Point","attributeCount": 0,"attributes": []},{"layer": "layer6","count": 1,"geometry": "Point","attributeCount": 0,"attributes": []},{"layer": "layer7","count": 1,"geometry": "Point","attributeCount": 0,"attributes": []}]}}

@hfu Do you have any advice?

hfu commented 2 years ago

I think the test should run tippecanoe with --maximum-zoom=6 and --minimum-zoom=0 because they control zoom levels in MBTiles.