Fix crash when using tile-join to copy an empty pmtiles tileset (#61)

* Fix crash when using tile-join to copy an empty pmtiles tileset

* Update changelog
This commit is contained in:
Erica Fischer
2023-01-17 15:16:22 -08:00
committed by GitHub
parent 3b2599f587
commit 54b47a6757
6 changed files with 44 additions and 3 deletions
+4
View File
@@ -1,3 +1,7 @@
## 2.18.0
* Fix crash when using tile-join to join an empty pmtiles tileset
## 2.17.0
* Add pmtiles output format
+23
View File
@@ -329,6 +329,29 @@ join-test: tile-join
./tippecanoe-decode -x generator tests/join-population/concat.mbtiles > tests/join-population/concat.mbtiles.json.check
cmp tests/join-population/concat.mbtiles.json.check tests/join-population/concat.mbtiles.json
rm tests/join-population/concat.mbtiles.json.check tests/join-population/concat.mbtiles tests/join-population/macarthur.mbtiles
#`
# Make sure empty tilesets work
#
# mbtiles:
./tippecanoe -q -z0 -f -o tests/join-population/empty.mbtiles tests/join-population/empty.json
./tile-join -f -o tests/join-population/empty.out.mbtiles tests/join-population/empty.mbtiles
./tippecanoe-decode -x generator -x generator_options -x name -x description tests/join-population/empty.mbtiles > tests/join-population/empty.out.json.check
cmp tests/join-population/empty.out.json.check tests/join-population/empty.out.json
rm -f tests/join-population/empty.mbtiles tests/join-population/empty.out.mbtiles tests/join-population/empty.out.json.check
# pmtiles:
./tippecanoe -q -z0 -f -o tests/join-population/empty.pmtiles tests/join-population/empty.json
./tile-join -f -o tests/join-population/empty.out.pmtiles tests/join-population/empty.pmtiles
./tippecanoe-decode -x generator -x generator_options -x name -x description tests/join-population/empty.pmtiles > tests/join-population/empty.out.json.check
cmp tests/join-population/empty.out.json.check tests/join-population/empty.out.json
rm -f tests/join-population/empty.pmtiles tests/join-population/empty.out.pmtiles tests/join-population/empty.out.json.check
# dirtiles:
./tippecanoe -q -z0 -f -e tests/join-population/empty.dirtiles tests/join-population/empty.json
./tile-join -f -e tests/join-population/empty.out.dirtiles tests/join-population/empty.dirtiles
./tippecanoe-decode -x generator -x generator_options -x name -x description tests/join-population/empty.dirtiles > tests/join-population/empty.out.json.check
cmp tests/join-population/empty.out.json.check tests/join-population/empty.out.json
rm -rf tests/join-population/empty.dirtiles tests/join-population/empty.out.dirtiles tests/join-population/empty.out.json.check
join-filter-test:
# Comes out different from the direct tippecanoe run because null attributes are lost
+2
View File
@@ -0,0 +1,2 @@
{ "type": "Feature", "properties": { "id": 1 }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 417.4513514, -299.1709459 ], [ 415.1435811, -288.1915541 ], [ 421.1577703, -286.2334459 ], [ 431.5077703, -317.4932432 ], [ 471.2293919, -312.2483108 ] ] ] } }
{ "type": "Feature", "properties": { "id": 2 }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 423.6753378, -364.5577703 ], [ 426.3327703, -334.0672297 ], [ 512.3496622, -321.7591216 ], [ 510.2516892, -347.4942568 ] ] ] } }
+11
View File
@@ -0,0 +1,11 @@
{ "type": "FeatureCollection", "properties": {
"bounds": "-180.000000,-85.051129,180.000000,-85.051129",
"center": "0.000000,-85.051129,0",
"format": "pbf",
"json": "{\"vector_layers\":[{\"id\":\"empty\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{\"id\":\"Number\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"empty\",\"count\":2,\"geometry\":\"LineString\",\"attributeCount\":1,\"attributes\":[{\"attribute\":\"id\",\"count\":2,\"type\":\"number\",\"values\":[1,2],\"min\":1,\"max\":2}]}]}}",
"maxzoom": "0",
"minzoom": "0",
"type": "overlay",
"version": "2"
}, "features": [
] }
+3 -2
View File
@@ -456,9 +456,10 @@ struct reader *begin_reading(char *fname) {
r->x = r->pmtiles_entries.back().x;
r->y = r->pmtiles_entries.back().y;
r->sorty = (1LL << r->zoom) - 1 - r->y;
r->data = std::string(r->pmtiles_map + r->pmtiles_entries.back().offset, r->pmtiles_entries.back().length);
r->pmtiles_entries.pop_back();
}
r->data = std::string(r->pmtiles_map + r->pmtiles_entries.back().offset, r->pmtiles_entries.back().length);
r->pmtiles_entries.pop_back();
} else {
sqlite3 *db;
+1 -1
View File
@@ -1,6 +1,6 @@
#ifndef VERSION_HPP
#define VERSION_HPP
#define VERSION "v2.17.0"
#define VERSION "v2.18.0"
#endif