diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d08ebd..67ef478 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.17.6 + +* Add tile-join options to set name, attribution, description + ## 1.17.5 * Preserve the tileset names from the source mbtiles in tile-join diff --git a/Makefile b/Makefile index 0024ce5..47388c9 100644 --- a/Makefile +++ b/Makefile @@ -157,7 +157,7 @@ join-test: cmp tests/join-population/joined-i.mbtiles.json.check tests/join-population/joined-i.mbtiles.json cmp tests/join-population/merged.mbtiles.json.check tests/join-population/merged.mbtiles.json cmp tests/join-population/windows.mbtiles.json.check tests/join-population/windows.mbtiles.json - ./tile-join -f -l macarthur -o tests/join-population/just-macarthur.mbtiles tests/join-population/merged.mbtiles + ./tile-join -f -l macarthur -n "macarthur name" -N "macarthur description" -A "macarthur attribution" -o tests/join-population/just-macarthur.mbtiles tests/join-population/merged.mbtiles ./tile-join -f -L macarthur -o tests/join-population/no-macarthur.mbtiles tests/join-population/merged.mbtiles ./tippecanoe-decode tests/join-population/just-macarthur.mbtiles > tests/join-population/just-macarthur.mbtiles.json.check ./tippecanoe-decode tests/join-population/no-macarthur.mbtiles > tests/join-population/no-macarthur.mbtiles.json.check diff --git a/README.md b/README.md index 00f799b..c536122 100644 --- a/README.md +++ b/README.md @@ -392,6 +392,9 @@ The options are: * `-pk`: Don't skip tiles larger than 500K. * `-l` *layer*: Include the named layer in the output. You can specify multiple `-l` options to keep multiple layers. If you don't specify, they will all be retained. * `-L` *layer*: Remove the named layer from the output. You can specify multiple `-L` options to remove multiple layers. + * `-A` *attribution*: Set the attribution string. + * `-n` *name*: Set the tileset name. + * `-N` *description*: Set the tileset description. Because tile-join just copies the geometries to the new .mbtiles without processing them (except to rescale the extents if necessary), diff --git a/man/tippecanoe.1 b/man/tippecanoe.1 index d80b17e..010a659 100644 --- a/man/tippecanoe.1 +++ b/man/tippecanoe.1 @@ -457,6 +457,12 @@ The options are: \fB\fC\-l\fR \fIlayer\fP: Include the named layer in the output. You can specify multiple \fB\fC\-l\fR options to keep multiple layers. If you don't specify, they will all be retained. .IP \(bu 2 \fB\fC\-L\fR \fIlayer\fP: Remove the named layer from the output. You can specify multiple \fB\fC\-L\fR options to remove multiple layers. +.IP \(bu 2 +\fB\fC\-A\fR \fIattribution\fP: Set the attribution string. +.IP \(bu 2 +\fB\fC\-n\fR \fIname\fP: Set the tileset name. +.IP \(bu 2 +\fB\fC\-N\fR \fIdescription\fP: Set the tileset description. .RE .PP Because tile\-join just copies the geometries to the new .mbtiles without processing them diff --git a/tests/join-population/just-macarthur.mbtiles.json b/tests/join-population/just-macarthur.mbtiles.json index 3c2f362..faeed2b 100644 --- a/tests/join-population/just-macarthur.mbtiles.json +++ b/tests/join-population/just-macarthur.mbtiles.json @@ -1,12 +1,13 @@ { "type": "FeatureCollection", "properties": { +"attribution": "macarthur attribution", "bounds": "-122.334735,37.695438,-122.104097,37.898925", "center": "-122.299805,37.892187,12", -"description": "tests/join-population/tabblock_06001420.mbtiles", +"description": "macarthur description", "format": "pbf", "json": "{\"vector_layers\": [ { \"id\": \"macarthur\", \"description\": \"\", \"minzoom\": 5, \"maxzoom\": 11, \"fields\": {\"FULLNAME\": \"String\", \"LINEARID\": \"String\", \"MTFCC\": \"String\", \"RTTYP\": \"String\"} } ] }", "maxzoom": "12", "minzoom": "0", -"name": "tests/join-population/macarthur.mbtiles + tests/join-population/macarthur2.mbtiles + tests/join-population/tabblock_06001420.mbtiles", +"name": "macarthur name", "type": "overlay", "version": "2" }, "features": [ diff --git a/tile-join.cpp b/tile-join.cpp index 4a6a99e..3454e5e 100644 --- a/tile-join.cpp +++ b/tile-join.cpp @@ -691,11 +691,13 @@ int main(int argc, char **argv) { std::set keep_layers; std::set remove_layers; + std::string set_name, set_description, set_attribution; + extern int optind; extern char *optarg; int i; - while ((i = getopt(argc, argv, "fo:c:x:ip:l:L:")) != -1) { + while ((i = getopt(argc, argv, "fo:c:x:ip:l:L:A:N:n:")) != -1) { switch (i) { case 'o': outfile = optarg; @@ -709,6 +711,18 @@ int main(int argc, char **argv) { ifmatched = 1; break; + case 'A': + set_attribution = optarg; + break; + + case 'n': + set_name = optarg; + break; + + case 'N': + set_description = optarg; + break; + case 'p': if (strcmp(optarg, "k") == 0) { pk = true; @@ -782,6 +796,16 @@ int main(int argc, char **argv) { decode(readers, csv, layermap, outdb, &st, header, mapping, exclude, ifmatched, attribution, description, keep_layers, remove_layers, name); + if (set_attribution.size() != 0) { + attribution = set_attribution; + } + if (set_description.size() != 0) { + description = set_description; + } + if (set_name.size() != 0) { + name = set_name; + } + mbtiles_write_metadata(outdb, NULL, name.c_str(), st.minzoom, st.maxzoom, st.minlat, st.minlon, st.maxlat, st.maxlon, st.midlat, st.midlon, 0, attribution.size() != 0 ? attribution.c_str() : NULL, layermap, true, description.c_str()); mbtiles_close(outdb, argv); diff --git a/version.hpp b/version.hpp index 5d1bd52..22946d4 100644 --- a/version.hpp +++ b/version.hpp @@ -1 +1 @@ -#define VERSION "tippecanoe v1.17.5\n" +#define VERSION "tippecanoe v1.17.6\n"