Skip to content

Commit

Permalink
Merge pull request #645 from mapbox/empty-tileset-dir
Browse files Browse the repository at this point in the history
Create the output tile directory even if there are no valid features
  • Loading branch information
e-n-f authored Sep 24, 2018
2 parents 03199a7 + b2999fe commit b7fb576
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions dirtiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions tests/raw-tiles/nothing.geojson
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "FeatureCollection",
"features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 999,999 ]} }
] }
13 changes: 13 additions & 0 deletions tests/raw-tiles/nothing.json
Original file line number Diff line number Diff line change
@@ -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": [
] }
2 changes: 1 addition & 1 deletion version.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef VERSION_HPP
#define VERSION_HPP

#define VERSION "v1.31.6"
#define VERSION "v1.31.7"

#endif

0 comments on commit b7fb576

Please sign in to comment.