diff --git a/README.md b/README.md index 1226e7b..0abd83f 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,29 @@ $ tippecanoe -o alameda.mbtiles -l alameda -n "Alameda County from TIGER" -z13 t $ cat tiger/tl_2014_*_roads.json | tippecanoe -o tiger.mbtiles -l roads -n "All TIGER roads, one zoom" -z12 -Z12 -d14 -x LINEARID -x RTTYP ``` +GeoJSON extension +----------------- + +Tippecanoe defines a GeoJSON extension that you can use to specify the minimum and/or maximum zoom level +at which an individual feature will be included in the vector tile dataset being produced. +If you have a feature like this: + +``` +{ + "type" : "Feature", + "tippecanoe" : { "maxzoom" : 9, "minzoom" : 4 }, + "properties" : { "FULLNAME" : "N Vasco Rd", }, + "geometry" : { + "type" : "LineString", + "coordinates" : [ ... ] + } +} +``` + +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`. + Point styling ------------- diff --git a/geojson.c b/geojson.c index 40edc40..4938f04 100644 --- a/geojson.c +++ b/geojson.c @@ -451,11 +451,17 @@ int serialize_geometry(json_object *geometry, json_object *properties, const cha if (min != NULL && min->type == JSON_NUMBER) { tippecanoe_minzoom = min->number; } + if (min != NULL && min->type == JSON_STRING) { + tippecanoe_minzoom = atoi(min->string); + } json_object *max = json_hash_get(tippecanoe, "maxzoom"); if (max != NULL && max->type == JSON_NUMBER) { tippecanoe_maxzoom = max->number; } + if (max != NULL && max->type == JSON_STRING) { + tippecanoe_maxzoom = atoi(max->string); + } } unsigned bbox[] = {UINT_MAX, UINT_MAX, 0, 0}; diff --git a/man/tippecanoe.1 b/man/tippecanoe.1 index 72322df..b216590 100644 --- a/man/tippecanoe.1 +++ b/man/tippecanoe.1 @@ -137,6 +137,29 @@ $ tippecanoe \-o alameda.mbtiles \-l alameda \-n "Alameda County from TIGER" \-z $ cat tiger/tl_2014_*_roads.json | tippecanoe \-o tiger.mbtiles \-l roads \-n "All TIGER roads, one zoom" \-z12 \-Z12 \-d14 \-x LINEARID \-x RTTYP .fi .RE +.SH GeoJSON extension +.PP +Tippecanoe defines a GeoJSON extension that you can use to specify the minimum and/or maximum zoom level +at which an individual feature will be included in the vector tile dataset being produced. +If you have a feature like this: +.PP +.RS +.nf +{ + "type" : "Feature", + "tippecanoe" : { "maxzoom" : 9, "minzoom" : 4 }, + "properties" : { "FULLNAME" : "N Vasco Rd", }, + "geometry" : { + "type" : "LineString", + "coordinates" : [ ... ] + } +} +.fi +.RE +.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\&. .SH Point styling .PP To provide a consistent density gradient as you zoom, the Mapbox Studio style needs to be