mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-04 17:35:42 +02:00
Add --containing-lat-lon and --containing-lon-lat decode options
This commit is contained in:
@@ -891,6 +891,8 @@ resolutions.
|
|||||||
* `-f` or `--force`: Decode tiles even if polygon ring order or closure problems are detected
|
* `-f` or `--force`: Decode tiles even if polygon ring order or closure problems are detected
|
||||||
* `-I` or `--integer`: Report coordinates in integer tile coordinates
|
* `-I` or `--integer`: Report coordinates in integer tile coordinates
|
||||||
* `-F` or `--fraction`: Report coordinates as a fraction of the tile extent
|
* `-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
|
tippecanoe-json-tool
|
||||||
====================
|
====================
|
||||||
|
|||||||
+31
-1
@@ -28,6 +28,9 @@ int minzoom = 0;
|
|||||||
int maxzoom = 32;
|
int maxzoom = 32;
|
||||||
bool force = false;
|
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) {
|
void do_stats(mvt_tile &tile, size_t size, bool compressed, int z, unsigned x, unsigned y, json_writer &state) {
|
||||||
state.json_write_hash();
|
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);
|
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);
|
sqlite3_finalize(stmt);
|
||||||
@@ -514,6 +528,8 @@ int main(int argc, char **argv) {
|
|||||||
{"stats", no_argument, 0, 'S'},
|
{"stats", no_argument, 0, 'S'},
|
||||||
{"force", no_argument, 0, 'f'},
|
{"force", no_argument, 0, 'f'},
|
||||||
{"exclude-metadata-row", required_argument, 0, 'x'},
|
{"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},
|
{0, 0, 0, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -573,6 +589,20 @@ int main(int argc, char **argv) {
|
|||||||
exclude_meta.insert(optarg);
|
exclude_meta.insert(optarg);
|
||||||
break;
|
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:
|
default:
|
||||||
usage(argv);
|
usage(argv);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user