From e8c5759f70b2eadb047b6c9a9e74e38b269eb966 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Tue, 6 Dec 2016 15:21:46 -0800 Subject: [PATCH] Dot-dropping doesn't apply if there is a per-feature minzoom tag --- CHANGELOG.md | 4 +++ README.md | 4 ++- man/tippecanoe.1 | 4 ++- tests/minzoom/in.json | 6 ++++ tests/minzoom/out/-z6.json | 66 ++++++++++++++++++++++++++++++++++++++ tile.cpp | 3 +- version.hpp | 2 +- 7 files changed, 84 insertions(+), 5 deletions(-) create mode 100644 tests/minzoom/in.json create mode 100644 tests/minzoom/out/-z6.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 6673676..417e156 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.15.4 + +* Dot-dropping with -r/-B doesn't apply if there is a per-feature minzoom tag + ## 1.15.3 * Round coordinates in low-zoom grid math instead of truncating diff --git a/README.md b/README.md index 2144636..6f31778 100644 --- a/README.md +++ b/README.md @@ -179,7 +179,9 @@ If you have a feature like this: with a `tippecanoe` object specifiying a `maxzoom` of 9 and a `minzoom` of 4, the feature will only appear in the vector tiles for zoom levels 4 through 9. Note that the `tippecanoe` -object belongs to the Feature, not to its `properties`. +object belongs to the Feature, not to its `properties`. If you specify a `minzoom` for a feature, +it will be preserved down to that zoom level even if dot-dropping with `-r` would otherwise have +dropped it. You can also specify a layer name in the `tippecanoe` object, which will take precedence over the filename or name specified using `--layer`, like this: diff --git a/man/tippecanoe.1 b/man/tippecanoe.1 index c3ad2ed..bfbda4e 100644 --- a/man/tippecanoe.1 +++ b/man/tippecanoe.1 @@ -223,7 +223,9 @@ If you have a feature like this: .PP with a \fB\fCtippecanoe\fR object specifiying a \fB\fCmaxzoom\fR of 9 and a \fB\fCminzoom\fR of 4, the feature will only appear in the vector tiles for zoom levels 4 through 9. Note that the \fB\fCtippecanoe\fR -object belongs to the Feature, not to its \fB\fCproperties\fR\&. +object belongs to the Feature, not to its \fB\fCproperties\fR\&. If you specify a \fB\fCminzoom\fR for a feature, +it will be preserved down to that zoom level even if dot\-dropping with \fB\fC\-r\fR would otherwise have +dropped it. .PP You can also specify a layer name in the \fB\fCtippecanoe\fR object, which will take precedence over the filename or name specified using \fB\fC\-\-layer\fR, like this: diff --git a/tests/minzoom/in.json b/tests/minzoom/in.json new file mode 100644 index 0000000..d03f380 --- /dev/null +++ b/tests/minzoom/in.json @@ -0,0 +1,6 @@ +{ "type": "Feature", "properties": {}, "geometry": { "type": "Point", "coordinates": [ 1, 1 ] }, "tippecanoe": { "minzoom": 1, "maxzoom": 1 } } +{ "type": "Feature", "properties": {}, "geometry": { "type": "Point", "coordinates": [ 2, 2 ] }, "tippecanoe": { "minzoom": 2, "maxzoom": 2 } } +{ "type": "Feature", "properties": {}, "geometry": { "type": "Point", "coordinates": [ 3, 3 ] }, "tippecanoe": { "minzoom": 3, "maxzoom": 3 } } +{ "type": "Feature", "properties": {}, "geometry": { "type": "Point", "coordinates": [ 4, 4 ] }, "tippecanoe": { "minzoom": 4, "maxzoom": 4 } } +{ "type": "Feature", "properties": {}, "geometry": { "type": "Point", "coordinates": [ 5, 5 ] }, "tippecanoe": { "minzoom": 5, "maxzoom": 5 } } +{ "type": "Feature", "properties": {}, "geometry": { "type": "Point", "coordinates": [ 6, 6 ] }, "tippecanoe": { "minzoom": 6, "maxzoom": 6 } } diff --git a/tests/minzoom/out/-z6.json b/tests/minzoom/out/-z6.json new file mode 100644 index 0000000..d96aa74 --- /dev/null +++ b/tests/minzoom/out/-z6.json @@ -0,0 +1,66 @@ +{ "type": "FeatureCollection", "properties": { +"bounds": "1.000000,1.000000,6.000000,6.000000", +"center": "6.000000,6.000000,6", +"description": "tests/minzoom/out/-z6.json.check.mbtiles", +"format": "pbf", +"json": "{\"vector_layers\": [ { \"id\": \"in\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 6, \"fields\": {} } ] }", +"maxzoom": "6", +"minzoom": "0", +"name": "tests/minzoom/out/-z6.json.check.mbtiles", +"type": "overlay", +"version": "2" +}, "features": [ +{ "type": "FeatureCollection", "properties": { "zoom": 1, "x": 0, "y": 1 }, "features": [ +{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [ +{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.966797, 1.010690 ] } } +] } +] } +, +{ "type": "FeatureCollection", "properties": { "zoom": 1, "x": 0, "y": 0 }, "features": [ +{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [ +{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.966797, 1.010690 ] } } +] } +] } +, +{ "type": "FeatureCollection", "properties": { "zoom": 1, "x": 1, "y": 1 }, "features": [ +{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [ +{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.966797, 1.010690 ] } } +] } +] } +, +{ "type": "FeatureCollection", "properties": { "zoom": 1, "x": 1, "y": 0 }, "features": [ +{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [ +{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 0.966797, 1.010690 ] } } +] } +] } +, +{ "type": "FeatureCollection", "properties": { "zoom": 2, "x": 2, "y": 1 }, "features": [ +{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [ +{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 1.999512, 2.021065 ] } } +] } +] } +, +{ "type": "FeatureCollection", "properties": { "zoom": 3, "x": 4, "y": 3 }, "features": [ +{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [ +{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 2.999268, 3.008870 ] } } +] } +] } +, +{ "type": "FeatureCollection", "properties": { "zoom": 4, "x": 8, "y": 7 }, "features": [ +{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [ +{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 3.999023, 4.001260 ] } } +] } +] } +, +{ "type": "FeatureCollection", "properties": { "zoom": 5, "x": 16, "y": 15 }, "features": [ +{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [ +{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 4.998779, 5.000658 ] } } +] } +] } +, +{ "type": "FeatureCollection", "properties": { "zoom": 6, "x": 33, "y": 30 }, "features": [ +{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [ +{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 5.999908, 6.001265 ] } } +] } +] } +] } diff --git a/tile.cpp b/tile.cpp index a494330..ae34f16 100644 --- a/tile.cpp +++ b/tile.cpp @@ -1473,8 +1473,7 @@ long long write_tile(FILE *geoms, long long *geompos_in, char *metabase, char *s if (tippecanoe_maxzoom != -1 && z > tippecanoe_maxzoom) { continue; } - - if (z < feature_minzoom) { + if (tippecanoe_minzoom == -1 && z < feature_minzoom) { continue; } diff --git a/version.hpp b/version.hpp index cb64cde..f443013 100644 --- a/version.hpp +++ b/version.hpp @@ -1 +1 @@ -#define VERSION "tippecanoe v1.15.3\n" +#define VERSION "tippecanoe v1.15.4\n"