Compare commits

...
Author SHA1 Message Date
Erica Fischer 47f22e95fc Add test 2022-11-18 14:46:41 -08:00
Erica Fischer f2d9359fb7 Add --containing-lat-lon and --containing-lon-lat decode options 2022-11-18 10:00:45 -08:00
6 changed files with 8670 additions and 2 deletions
+4
View File
@@ -1,3 +1,7 @@
## 2.14.0
* Add --containing-lat-lon and --containing-lon-lat options to tippecanoe-decode
## 2.13.0
* Add --limit-tile-feature-count and --limit-tile-feature-count-at-maximum-zoom
+4
View File
@@ -164,12 +164,16 @@ decode-test:
./tippecanoe-decode -x generator -l subway --fraction tests/muni/decode/multi.mbtiles > tests/muni/decode/multi.mbtiles.fraction.json.check
./tippecanoe-decode -x generator -c tests/muni/decode/multi.mbtiles > tests/muni/decode/multi.mbtiles.pipeline.json.check
./tippecanoe-decode -x generator tests/muni/decode/multi.mbtiles 11 327 791 > tests/muni/decode/multi.mbtiles.onetile.json.check
./tippecanoe-decode -x generator --containing-lat-lon 37.7615594,-122.421015 tests/muni/decode/multi.mbtiles > tests/muni/decode/multi.mbtiles.containing-lat.json.check
./tippecanoe-decode -x generator --containing-lon-lat=-122.421015,37.7615594 tests/muni/decode/multi.mbtiles > tests/muni/decode/multi.mbtiles.containing-lon.json.check
./tippecanoe-decode -x generator --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.integer.json.check tests/muni/decode/multi.mbtiles.integer.json
cmp tests/muni/decode/multi.mbtiles.fraction.json.check tests/muni/decode/multi.mbtiles.fraction.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.containing-lat.json.check tests/muni/decode/multi.mbtiles.containing.json
cmp tests/muni/decode/multi.mbtiles.containing-lon.json.check tests/muni/decode/multi.mbtiles.containing.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 tests/muni/decode/multi.mbtiles.onetile.json.check
+2
View File
@@ -891,6 +891,8 @@ resolutions.
* `-f` or `--force`: Decode tiles even if polygon ring order or closure problems are detected
* `-I` or `--integer`: Report coordinates in integer tile coordinates
* `-F` or `--fraction`: Report coordinates as a fraction of the tile extent
* `-m` _lat_,_lon_ or `--containing-lat-lon`=_lat_,_lon_: Decode only tiles containing the specified point
* `-M` _lon_,_lat_ or `--containing-lon-lat`=_lon_,_lat_: Decode only tiles containing the specified point
tippecanoe-json-tool
====================
+31 -1
View File
@@ -28,6 +28,9 @@ int minzoom = 0;
int maxzoom = 32;
bool force = false;
double containing_lon = -500;
double containing_lat = -500;
void do_stats(mvt_tile &tile, size_t size, bool compressed, int z, unsigned x, unsigned y, json_writer &state) {
state.json_write_hash();
@@ -425,7 +428,18 @@ void decode(char *fname, int z, unsigned x, unsigned y, std::set<std::string> co
exit(EXIT_SQLITE);
}
handle(std::string(s, len), tz, tx, ty, to_decode, pipeline, stats, state, coordinate_mode);
bool contains = true;
if (containing_lat > -500 && containing_lon > -500) {
long long ctx, cty;
lonlat2tile(containing_lon, containing_lat, tz, &ctx, &cty);
if (tx != ctx || ty != cty) {
contains = false;
}
}
if (contains) {
handle(std::string(s, len), tz, tx, ty, to_decode, pipeline, stats, state, coordinate_mode);
}
}
sqlite3_finalize(stmt);
@@ -514,6 +528,8 @@ int main(int argc, char **argv) {
{"stats", no_argument, 0, 'S'},
{"force", no_argument, 0, 'f'},
{"exclude-metadata-row", required_argument, 0, 'x'},
{"containing-lat-lon", required_argument, 0, 'm'},
{"containing-lon-lat", required_argument, 0, 'M'},
{0, 0, 0, 0},
};
@@ -573,6 +589,20 @@ int main(int argc, char **argv) {
exclude_meta.insert(optarg);
break;
case 'm':
if (sscanf(optarg, "%lf,%lf", &containing_lat, &containing_lon) != 2) {
fprintf(stderr, "-m option is lat,lon\n");
exit(EXIT_FAILURE);
}
break;
case 'M':
if (sscanf(optarg, "%lf,%lf", &containing_lon, &containing_lat) != 2) {
fprintf(stderr, "-m option is lon,lat\n");
exit(EXIT_FAILURE);
}
break;
default:
usage(argv);
}
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,6 +1,6 @@
#ifndef VERSION_HPP
#define VERSION_HPP
#define VERSION "v2.13.0"
#define VERSION "v2.14.0"
#endif