Add tile-join -pk option not to care about byte limit. Update docs.

This commit is contained in:
Eric Fischer 2016-09-19 17:20:44 -07:00
parent 232056c0da
commit d7037f3d3a
5 changed files with 37 additions and 9 deletions

View File

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

View File

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

View File

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

View File

@ -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<std::string, layermap_en
if (anything) {
std::string compressed = tile.encode();
if (compressed.size() > 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<std::string, layermap_en
}
void usage(char **argv) {
fprintf(stderr, "Usage: %s [-f] [-i] [-c joins.csv] [-x exclude ...] -o new.mbtiles source.mbtiles ...\n", argv[0]);
fprintf(stderr, "Usage: %s [-f] [-i] [-pk] [-c joins.csv] [-x exclude ...] -o new.mbtiles source.mbtiles ...\n", argv[0]);
exit(EXIT_FAILURE);
}
@ -483,7 +485,7 @@ int main(int argc, char **argv) {
extern char *optarg;
int i;
while ((i = getopt(argc, argv, "fo:c:x:i")) != -1) {
while ((i = getopt(argc, argv, "fo:c:x:ip:")) != -1) {
switch (i) {
case 'o':
outfile = optarg;
@ -497,6 +499,15 @@ int main(int argc, char **argv) {
ifmatched = 1;
break;
case 'p':
if (strcmp(optarg, "k") == 0) {
pk = true;
} else {
fprintf(stderr, "%s: Unknown option for -p%s\n", argv[0], optarg);
exit(EXIT_FAILURE);
}
break;
case 'c':
if (csv != NULL) {
fprintf(stderr, "Only one -c for now\n");

View File

@ -1 +1 @@
#define VERSION "tippecanoe v1.13.0\n"
#define VERSION "tippecanoe v1.14.0\n"