mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-03-23 12:25:16 +00:00
Always include tile and layer in tippecanoe-decode, fixing corrupt JSON.
This commit is contained in:
parent
e690a1b585
commit
71df4d3e81
@ -1,3 +1,7 @@
|
||||
## 1.27.11
|
||||
|
||||
* Always include tile and layer in tippecanoe-decode, fixing corrupt JSON.
|
||||
|
||||
## 1.27.10
|
||||
|
||||
* Add --progress-interval setting to reduce progress indicator frequency
|
||||
|
3
Makefile
3
Makefile
@ -143,9 +143,10 @@ decode-test:
|
||||
./tippecanoe -z11 -Z11 -f -o tests/muni/decode/multi.mbtiles tests/muni/*.json
|
||||
./tippecanoe-decode -l subway tests/muni/decode/multi.mbtiles > tests/muni/decode/multi.mbtiles.json.check
|
||||
./tippecanoe-decode -c tests/muni/decode/multi.mbtiles > tests/muni/decode/multi.mbtiles.pipeline.json.check
|
||||
./tippecanoe-decode tests/muni/decode/multi.mbtiles 11 327 791 > tests/muni/decode/multi.mbtiles.onetile.json.check
|
||||
./tippecanoe-decode --stats tests/muni/decode/multi.mbtiles > tests/muni/decode/multi.mbtiles.stats.json.check
|
||||
cmp tests/muni/decode/multi.mbtiles.json.check tests/muni/decode/multi.mbtiles.json
|
||||
cmp tests/muni/decode/multi.mbtiles.pipeline.json.check tests/muni/decode/multi.mbtiles.pipeline.json
|
||||
cmp tests/muni/decode/multi.mbtiles.onetile.json.check tests/muni/decode/multi.mbtiles.onetile.json
|
||||
cmp tests/muni/decode/multi.mbtiles.stats.json.check tests/muni/decode/multi.mbtiles.stats.json
|
||||
rm -f tests/muni/decode/multi.mbtiles.json.check tests/muni/decode/multi.mbtiles tests/muni/decode/multi.mbtiles.pipeline.json.check tests/muni/decode/multi.mbtiles.stats.json.check
|
||||
|
||||
|
@ -604,7 +604,7 @@ or on an individual tile:
|
||||
tippecanoe-decode file.mbtiles zoom x y
|
||||
tippecanoe-decode file.vector.pbf zoom x y
|
||||
|
||||
If you decode an entire file, you get a nested `FeatureCollection` identifying each
|
||||
Unless you use `-c`, the output is a set of nested FeatureCollections identifying each
|
||||
tile and layer separately. Note that the same features generally appear at all zooms,
|
||||
so the output for the file will have many copies of the same features at different
|
||||
resolutions.
|
||||
|
16
decode.cpp
16
decode.cpp
@ -54,7 +54,7 @@ void do_stats(mvt_tile &tile, size_t size, bool compressed, int z, unsigned x, u
|
||||
printf(" } }\n");
|
||||
}
|
||||
|
||||
void handle(std::string message, int z, unsigned x, unsigned y, int describe, std::set<std::string> const &to_decode, bool pipeline, bool stats) {
|
||||
void handle(std::string message, int z, unsigned x, unsigned y, std::set<std::string> const &to_decode, bool pipeline, bool stats) {
|
||||
mvt_tile tile;
|
||||
bool was_compressed;
|
||||
|
||||
@ -76,7 +76,7 @@ void handle(std::string message, int z, unsigned x, unsigned y, int describe, st
|
||||
if (!pipeline) {
|
||||
printf("{ \"type\": \"FeatureCollection\"");
|
||||
|
||||
if (describe) {
|
||||
if (true) {
|
||||
printf(", \"properties\": { \"zoom\": %d, \"x\": %d, \"y\": %d", z, x, y);
|
||||
if (!was_compressed) {
|
||||
printf(", \"compressed\": false");
|
||||
@ -107,7 +107,7 @@ void handle(std::string message, int z, unsigned x, unsigned y, int describe, st
|
||||
}
|
||||
|
||||
if (!pipeline) {
|
||||
if (describe) {
|
||||
if (true) {
|
||||
if (!first_layer) {
|
||||
printf(",\n");
|
||||
}
|
||||
@ -132,7 +132,7 @@ void handle(std::string message, int z, unsigned x, unsigned y, int describe, st
|
||||
layer_to_geojson(stdout, layer, z, x, y, !pipeline, pipeline, pipeline, false, 0, 0, 0, !force);
|
||||
|
||||
if (!pipeline) {
|
||||
if (describe) {
|
||||
if (true) {
|
||||
printf("] }\n");
|
||||
}
|
||||
}
|
||||
@ -159,7 +159,7 @@ void decode(char *fname, int z, unsigned x, unsigned y, std::set<std::string> co
|
||||
if (strcmp(map, "SQLite format 3") != 0) {
|
||||
if (z >= 0) {
|
||||
std::string s = std::string(map, st.st_size);
|
||||
handle(s, z, x, y, 1, to_decode, pipeline, stats);
|
||||
handle(s, z, x, y, to_decode, pipeline, stats);
|
||||
munmap(map, st.st_size);
|
||||
return;
|
||||
} else {
|
||||
@ -269,7 +269,7 @@ void decode(char *fname, int z, unsigned x, unsigned y, std::set<std::string> co
|
||||
}
|
||||
fclose(f);
|
||||
|
||||
handle(s, tiles[i].z, tiles[i].x, tiles[i].y, 1, to_decode, pipeline, stats);
|
||||
handle(s, tiles[i].z, tiles[i].x, tiles[i].y, to_decode, pipeline, stats);
|
||||
}
|
||||
} else {
|
||||
const char *sql = "SELECT tile_data, zoom_level, tile_column, tile_row from tiles where zoom_level between ? and ? order by zoom_level, tile_column, tile_row;";
|
||||
@ -310,7 +310,7 @@ void decode(char *fname, int z, unsigned x, unsigned y, std::set<std::string> co
|
||||
ty = (1LL << tz) - 1 - ty;
|
||||
const char *s = (const char *) sqlite3_column_blob(stmt, 0);
|
||||
|
||||
handle(std::string(s, len), tz, tx, ty, 1, to_decode, pipeline, stats);
|
||||
handle(std::string(s, len), tz, tx, ty, to_decode, pipeline, stats);
|
||||
}
|
||||
|
||||
sqlite3_finalize(stmt);
|
||||
@ -344,7 +344,7 @@ void decode(char *fname, int z, unsigned x, unsigned y, std::set<std::string> co
|
||||
fprintf(stderr, "%s: Warning: using tile %d/%u/%u instead of %d/%u/%u\n", fname, z, x, y, oz, ox, oy);
|
||||
}
|
||||
|
||||
handle(std::string(s, len), z, x, y, 0, to_decode, pipeline, stats);
|
||||
handle(std::string(s, len), z, x, y, to_decode, pipeline, stats);
|
||||
handled = 1;
|
||||
}
|
||||
|
||||
|
@ -723,7 +723,7 @@ tippecanoe\-decode file.vector.pbf zoom x y
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
If you decode an entire file, you get a nested \fB\fCFeatureCollection\fR identifying each
|
||||
Unless you use \fB\fC\-c\fR, the output is a set of nested FeatureCollections identifying each
|
||||
tile and layer separately. Note that the same features generally appear at all zooms,
|
||||
so the output for the file will have many copies of the same features at different
|
||||
resolutions.
|
||||
|
8613
tests/muni/decode/multi.mbtiles.onetile.json
Normal file
8613
tests/muni/decode/multi.mbtiles.onetile.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
#ifndef VERSION_HPP
|
||||
#define VERSION_HPP
|
||||
|
||||
#define VERSION "tippecanoe v1.27.10\n"
|
||||
#define VERSION "tippecanoe v1.27.11\n"
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user