diff --git a/CHANGELOG.md b/CHANGELOG.md index a8464dd..5e7fd0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.14.0 + +* Tile-join can merge multiple vector mbtiles files together + ## 1.13.0 * Add the ability to specify layer names within the GeoJSON input diff --git a/README.md b/README.md index 735e8ab..26a75df 100644 --- a/README.md +++ b/README.md @@ -285,6 +285,10 @@ Tile-join is a tool for joining new attributes from a CSV file to features that have already been tiled with tippecanoe. It reads the tiles from an existing .mbtiles file, matches them against the records of the CSV, and writes out a new tileset. +If you specify multiple source mbtiles files, they are all read and their combined +contents are written to the new mbtiles output. If they define the same layers or +the same tiles, the layers or tiles are merged. + The options are: * -o *out.mbtiles*: Write the new tiles to the specified .mbtiles file @@ -292,10 +296,12 @@ The options are: * -c *match.csv*: Use *match.csv* as the source for new attributes to join to the features. The first line of the file should be the key names; the other lines are values. The first column is the one to match against the existing features; the other columns are the new data to add. * -x *key*: Remove attributes of type *key* from the output. You can use this to remove the field you are matching against if you no longer need it after joining, or to remove any other attributes you don't want. * -i: Only include features that matched the CSV. + * -pk: Don't skip tiles larger than 500K. -Because tile-join just copies the geometries to the new .mbtiles without processing them, +Because tile-join just copies the geometries to the new .mbtiles without processing them +(except to rescale the extents if necessary), it doesn't have any of tippecanoe's recourses if the new tiles are bigger than the 500K tile limit. -If a tile is too big, it is just left out of the new tileset. +If a tile is too big and you haven't specified `-pk`, it is just left out of the new tileset. Example ------- diff --git a/man/tippecanoe.1 b/man/tippecanoe.1 index b4596e1..05c24ab 100644 --- a/man/tippecanoe.1 +++ b/man/tippecanoe.1 @@ -119,7 +119,7 @@ resolution is obtained than by using a smaller \fImaxzoom\fP or \fIdetail\fP\&. .SS Point simplification .RS .IP \(bu 2 -\-r \fIrate\fP or \-\-drop\fIrate=\fPrate_: Rate at which dots are dropped at zoom levels below basezoom (default 2.5). +\-r \fIrate\fP or \-\-drop\-rate=\fIrate\fP: Rate at which dots are dropped at zoom levels below basezoom (default 2.5). If you use \-rg, it will guess a drop rate that will keep at most 50,000 features in the densest tile. You can also specify a marker\-width with \-rg\fIwidth\fP to allow fewer features in the densest tile to compensate for the larger marker, or \-rf\fInumber\fP to allow at most \fInumber\fP features in the densest tile. @@ -327,6 +327,10 @@ Tile\-join is a tool for joining new attributes from a CSV file to features that have already been tiled with tippecanoe. It reads the tiles from an existing .mbtiles file, matches them against the records of the CSV, and writes out a new tileset. .PP +If you specify multiple source mbtiles files, they are all read and their combined +contents are written to the new mbtiles output. If they define the same layers or +the same tiles, the layers or tiles are merged. +.PP The options are: .RS .IP \(bu 2 @@ -339,11 +343,14 @@ The options are: \-x \fIkey\fP: Remove attributes of type \fIkey\fP from the output. You can use this to remove the field you are matching against if you no longer need it after joining, or to remove any other attributes you don't want. .IP \(bu 2 \-i: Only include features that matched the CSV. +.IP \(bu 2 +\-pk: Don't skip tiles larger than 500K. .RE .PP -Because tile\-join just copies the geometries to the new .mbtiles without processing them, +Because tile\-join just copies the geometries to the new .mbtiles without processing them +(except to rescale the extents if necessary), it doesn't have any of tippecanoe's recourses if the new tiles are bigger than the 500K tile limit. -If a tile is too big, it is just left out of the new tileset. +If a tile is too big and you haven't specified \fB\fC\-pk\fR, it is just left out of the new tileset. .SH Example .PP Imagine you have a tileset of census blocks: diff --git a/tile-join.cpp b/tile-join.cpp index 7ab3c1c..58c08e8 100644 --- a/tile-join.cpp +++ b/tile-join.cpp @@ -18,6 +18,8 @@ std::string dequote(std::string s); +bool pk = false; + struct stats { int minzoom; int maxzoom; @@ -301,7 +303,7 @@ void decode(struct reader *readers, char *map, std::map 500000) { + if (!pk && compressed.size() > 500000) { fprintf(stderr, "Tile %lld/%lld/%lld size is %lld, >500000. Skipping this tile\n.", r->zoom, r->x, r->y, (long long) compressed.size()); } else { mbtiles_write_tile(outdb, r->zoom, r->x, r->y, compressed.data(), compressed.size()); @@ -390,7 +392,7 @@ void decode(struct reader *readers, char *map, std::map