mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-02-02 01:08:14 +00:00
Add -f option to overwrite existing mbtiles file
This commit is contained in:
parent
c02c91df5a
commit
f0d2dbd2a8
@ -24,7 +24,8 @@ Options
|
|||||||
* -Z Lowest zoom level (default 0)
|
* -Z Lowest zoom level (default 0)
|
||||||
* -d Detail at base zoom level (default 12, for tile resolution of 4096)
|
* -d Detail at base zoom level (default 12, for tile resolution of 4096)
|
||||||
* -D Detail at lower zoom levels (default 10, for tile resolution of 1024)
|
* -D Detail at lower zoom levels (default 10, for tile resolution of 1024)
|
||||||
* -x property (removes the named properties from all features)
|
* -x Property (removes the named properties from all features)
|
||||||
|
* -f Force: Delete existing mbtiles file if it already exists.
|
||||||
|
|
||||||
Example
|
Example
|
||||||
-------
|
-------
|
||||||
|
11
geojson.c
11
geojson.c
@ -538,11 +538,12 @@ int main(int argc, char **argv) {
|
|||||||
char *outdir = NULL;
|
char *outdir = NULL;
|
||||||
int maxzoom = 14;
|
int maxzoom = 14;
|
||||||
int minzoom = 0;
|
int minzoom = 0;
|
||||||
|
int force = 0;
|
||||||
|
|
||||||
struct pool exclude;
|
struct pool exclude;
|
||||||
pool_init(&exclude, 0);
|
pool_init(&exclude, 0);
|
||||||
|
|
||||||
while ((i = getopt(argc, argv, "l:n:z:Z:d:D:o:x:")) != -1) {
|
while ((i = getopt(argc, argv, "l:n:z:Z:d:D:o:x:f")) != -1) {
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case 'n':
|
case 'n':
|
||||||
name = optarg;
|
name = optarg;
|
||||||
@ -576,6 +577,10 @@ int main(int argc, char **argv) {
|
|||||||
pool(&exclude, optarg, VT_STRING);
|
pool(&exclude, optarg, VT_STRING);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'f':
|
||||||
|
force = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Usage: %s -o out.mbtiles [-n name] [-l layername] [-z maxzoom] [-Z minzoom] [-d detail] [-D lower-detail] [-x excluded-field ...] [file.json]\n", argv[0]);
|
fprintf(stderr, "Usage: %s -o out.mbtiles [-n name] [-l layername] [-z maxzoom] [-Z minzoom] [-d detail] [-D lower-detail] [-x excluded-field ...] [file.json]\n", argv[0]);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
@ -587,6 +592,10 @@ int main(int argc, char **argv) {
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (force) {
|
||||||
|
unlink(outdir);
|
||||||
|
}
|
||||||
|
|
||||||
sqlite3 *outdb = mbtiles_open(outdir, argv);
|
sqlite3 *outdb = mbtiles_open(outdir, argv);
|
||||||
|
|
||||||
if (argc == optind + 1) {
|
if (argc == optind + 1) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user