From b2999fe9a8f3d1e6399d034d61622850e1b3d0a5 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Mon, 24 Sep 2018 11:16:13 -0700 Subject: [PATCH] Create the output tile directory even if there are no valid features --- CHANGELOG.md | 4 ++++ Makefile | 7 ++++++- dirtiles.cpp | 1 + tests/raw-tiles/nothing.geojson | 5 +++++ tests/raw-tiles/nothing.json | 13 +++++++++++++ version.hpp | 2 +- 6 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 tests/raw-tiles/nothing.geojson create mode 100644 tests/raw-tiles/nothing.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c93c10..2c1d209 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.31.7 + +* Create the output tile directory even if there are no valid features + ## 1.31.6 * Issue an error message in tile-join if minzoom is greater than maxzoom diff --git a/Makefile b/Makefile index dc6c1fc..cad2b18 100644 --- a/Makefile +++ b/Makefile @@ -137,10 +137,15 @@ parallel-test: rm tests/parallel/*.mbtiles tests/parallel/*.json raw-tiles-test: - ./tippecanoe -q -f -e tests/raw-tiles/raw-tiles -r1 tests/raw-tiles/hackspots.geojson -pC + ./tippecanoe -q -f -e tests/raw-tiles/raw-tiles -r1 -pC tests/raw-tiles/hackspots.geojson ./tippecanoe-decode -x generator tests/raw-tiles/raw-tiles > tests/raw-tiles/raw-tiles.json.check cmp tests/raw-tiles/raw-tiles.json.check tests/raw-tiles/raw-tiles.json rm -rf tests/raw-tiles/raw-tiles tests/raw-tiles/compare.json.check + # Test that metadata.json is created even if all features are clipped away + ./tippecanoe -q -f -e tests/raw-tiles/nothing tests/raw-tiles/nothing.geojson + ./tippecanoe-decode -x generator tests/raw-tiles/nothing > tests/raw-tiles/nothing.json.check + cmp tests/raw-tiles/nothing.json.check tests/raw-tiles/nothing.json + rm -r tests/raw-tiles/nothing tests/raw-tiles/nothing.json.check decode-test: mkdir -p tests/muni/decode diff --git a/dirtiles.cpp b/dirtiles.cpp index 3104caf..51773c7 100644 --- a/dirtiles.cpp +++ b/dirtiles.cpp @@ -65,6 +65,7 @@ static bool pbfname(const char *s) { void check_dir(const char *dir, bool force, bool forcetable) { struct stat st; + mkdir(dir, S_IRWXU | S_IRWXG | S_IRWXO); std::string meta = std::string(dir) + "/" + "metadata.json"; if (force) { unlink(meta.c_str()); // error OK since it may not exist; diff --git a/tests/raw-tiles/nothing.geojson b/tests/raw-tiles/nothing.geojson new file mode 100644 index 0000000..bfbf441 --- /dev/null +++ b/tests/raw-tiles/nothing.geojson @@ -0,0 +1,5 @@ +{ +"type": "FeatureCollection", +"features": [ +{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 999,999 ]} } +] } diff --git a/tests/raw-tiles/nothing.json b/tests/raw-tiles/nothing.json new file mode 100644 index 0000000..8c91ef8 --- /dev/null +++ b/tests/raw-tiles/nothing.json @@ -0,0 +1,13 @@ +{ "type": "FeatureCollection", "properties": { +"bounds": "-180.000000,85.051129,180.000000,85.051129", +"center": "-179.989014,85.051129,14", +"description": "tests/raw-tiles/nothing", +"format": "pbf", +"json": "{\"vector_layers\": [ { \"id\": \"nothing\", \"description\": \"\", \"minzoom\": 0, \"maxzoom\": 14, \"fields\": {} } ],\"tilestats\": {\"layerCount\": 1,\"layers\": [{\"layer\": \"nothing\",\"count\": 1,\"geometry\": \"Point\",\"attributeCount\": 0,\"attributes\": []}]}}", +"maxzoom": "14", +"minzoom": "0", +"name": "tests/raw-tiles/nothing", +"type": "overlay", +"version": "2" +}, "features": [ +] } diff --git a/version.hpp b/version.hpp index 6d57807..e8db512 100644 --- a/version.hpp +++ b/version.hpp @@ -1,6 +1,6 @@ #ifndef VERSION_HPP #define VERSION_HPP -#define VERSION "v1.31.6" +#define VERSION "v1.31.7" #endif