Merge pull request #411 from mapbox/tile-join-name

Add tile-join options to set tileset name, description, attribution
This commit is contained in:
Eric Fischer 2017-05-04 15:27:40 -07:00 committed by GitHub
commit eab593fea5
7 changed files with 43 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -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),

View File

@ -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

View File

@ -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": [

View File

@ -691,11 +691,13 @@ int main(int argc, char **argv) {
std::set<std::string> keep_layers;
std::set<std::string> 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);

View File

@ -1 +1 @@
#define VERSION "tippecanoe v1.17.5\n"
#define VERSION "tippecanoe v1.17.6\n"