mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 18:05:42 +02:00
Add multiplier stripping from tippecanoe-overzoom to tile-join
This commit is contained in:
@@ -810,6 +810,9 @@ The options are:
|
|||||||
* `-j` *filter* or `--feature-filter`=*filter*: Check features against a per-layer filter (as defined in the [Mapbox GL Style Specification](https://docs.mapbox.com/mapbox-gl-js/style-spec/#other-filter)) and only include those that match. Any features in layers that have no filter specified will be passed through. Filters for the layer `"*"` apply to all layers.
|
* `-j` *filter* or `--feature-filter`=*filter*: Check features against a per-layer filter (as defined in the [Mapbox GL Style Specification](https://docs.mapbox.com/mapbox-gl-js/style-spec/#other-filter)) and only include those that match. Any features in layers that have no filter specified will be passed through. Filters for the layer `"*"` apply to all layers.
|
||||||
* `-J` *filter-file* or `--feature-filter-file`=*filter-file*: Like `-j`, but read the filter from a file.
|
* `-J` *filter-file* or `--feature-filter-file`=*filter-file*: Like `-j`, but read the filter from a file.
|
||||||
* `-pe` or `--empty-csv-columns-are-null`: Treat empty CSV columns as nulls rather than as empty strings.
|
* `-pe` or `--empty-csv-columns-are-null`: Treat empty CSV columns as nulls rather than as empty strings.
|
||||||
|
* `-m`: If a tile was created with the `--retain-points-multiplier` option, thin the tile back down to its normal feature count during overzooming. The first feature from each cluster will be retained, unless `-j` is used to specify a filter, in which case the first matching filter from each cluster will be retained instead.
|
||||||
|
* `--preserve-input-order`: Restore a set of filtered features to its original input order
|
||||||
|
* `--accumulate-attribute`: Behaves as in `tippecanoe` to sum attributes from the features of a multiplier cluster that are not included in the final output. The attributes from features that are filtered away with `-j` are *not* accumulated onto the output feature.
|
||||||
|
|
||||||
### Setting or disabling tile size limits
|
### Setting or disabling tile size limits
|
||||||
|
|
||||||
|
|||||||
@@ -1033,6 +1033,12 @@ The options are:
|
|||||||
\fB\fC\-J\fR \fIfilter\-file\fP or \fB\fC\-\-feature\-filter\-file\fR=\fIfilter\-file\fP: Like \fB\fC\-j\fR, but read the filter from a file.
|
\fB\fC\-J\fR \fIfilter\-file\fP or \fB\fC\-\-feature\-filter\-file\fR=\fIfilter\-file\fP: Like \fB\fC\-j\fR, but read the filter from a file.
|
||||||
.IP \(bu 2
|
.IP \(bu 2
|
||||||
\fB\fC\-pe\fR or \fB\fC\-\-empty\-csv\-columns\-are\-null\fR: Treat empty CSV columns as nulls rather than as empty strings.
|
\fB\fC\-pe\fR or \fB\fC\-\-empty\-csv\-columns\-are\-null\fR: Treat empty CSV columns as nulls rather than as empty strings.
|
||||||
|
.IP \(bu 2
|
||||||
|
\fB\fC\-m\fR: If a tile was created with the \fB\fC\-\-retain\-points\-multiplier\fR option, thin the tile back down to its normal feature count during overzooming. The first feature from each cluster will be retained, unless \fB\fC\-j\fR is used to specify a filter, in which case the first matching filter from each cluster will be retained instead.
|
||||||
|
.IP \(bu 2
|
||||||
|
\fB\fC\-\-preserve\-input\-order\fR: Restore a set of filtered features to its original input order
|
||||||
|
.IP \(bu 2
|
||||||
|
\fB\fC\-\-accumulate\-attribute\fR: Behaves as in \fB\fCtippecanoe\fR to sum attributes from the features of a multiplier cluster that are not included in the final output. The attributes from features that are filtered away with \fB\fC\-j\fR are \fInot\fP accumulated onto the output feature.
|
||||||
.RE
|
.RE
|
||||||
.SS Setting or disabling tile size limits
|
.SS Setting or disabling tile size limits
|
||||||
.RS
|
.RS
|
||||||
|
|||||||
@@ -55,6 +55,9 @@ int minzoom = 0;
|
|||||||
std::map<std::string, std::string> renames;
|
std::map<std::string, std::string> renames;
|
||||||
bool exclude_all = false;
|
bool exclude_all = false;
|
||||||
std::vector<std::string> unidecode_data;
|
std::vector<std::string> unidecode_data;
|
||||||
|
bool preserve_input_order = false;
|
||||||
|
bool demultiply = false;
|
||||||
|
std::unordered_map<std::string, attribute_op> attribute_accum;
|
||||||
|
|
||||||
bool want_overzoom = false;
|
bool want_overzoom = false;
|
||||||
int buffer = 5;
|
int buffer = 5;
|
||||||
@@ -73,6 +76,12 @@ struct stats {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void append_tile(std::string message, int z, unsigned x, unsigned y, std::map<std::string, layermap_entry> &layermap, std::vector<std::string> &header, std::map<std::string, std::vector<std::string>> &mapping, std::set<std::string> &exclude, std::set<std::string> &include, std::set<std::string> &keep_layers, std::set<std::string> &remove_layers, int ifmatched, mvt_tile &outtile, json_object *filter) {
|
void append_tile(std::string message, int z, unsigned x, unsigned y, std::map<std::string, layermap_entry> &layermap, std::vector<std::string> &header, std::map<std::string, std::vector<std::string>> &mapping, std::set<std::string> &exclude, std::set<std::string> &include, std::set<std::string> &keep_layers, std::set<std::string> &remove_layers, int ifmatched, mvt_tile &outtile, json_object *filter) {
|
||||||
|
if (attribute_accum.size() > 0 || demultiply) {
|
||||||
|
message = overzoom(message, z, x, y, z, x, y,
|
||||||
|
-1 /* detail */, 128 /* buffer */, include, false /* compress */, NULL /* child tiles */,
|
||||||
|
demultiply, filter, preserve_input_order, attribute_accum, unidecode_data);
|
||||||
|
}
|
||||||
|
|
||||||
mvt_tile tile;
|
mvt_tile tile;
|
||||||
int features_added = 0;
|
int features_added = 0;
|
||||||
bool was_compressed;
|
bool was_compressed;
|
||||||
@@ -735,6 +744,7 @@ struct arg {
|
|||||||
std::set<std::string> *remove_layers = NULL;
|
std::set<std::string> *remove_layers = NULL;
|
||||||
int ifmatched = 0;
|
int ifmatched = 0;
|
||||||
json_object *filter = NULL;
|
json_object *filter = NULL;
|
||||||
|
|
||||||
struct tileset_reader *readers = NULL;
|
struct tileset_reader *readers = NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1235,6 +1245,9 @@ int main(int argc, char **argv) {
|
|||||||
{"tile-stats-attributes-limit", required_argument, 0, '~'},
|
{"tile-stats-attributes-limit", required_argument, 0, '~'},
|
||||||
{"tile-stats-sample-values-limit", required_argument, 0, '~'},
|
{"tile-stats-sample-values-limit", required_argument, 0, '~'},
|
||||||
{"tile-stats-values-limit", required_argument, 0, '~'},
|
{"tile-stats-values-limit", required_argument, 0, '~'},
|
||||||
|
{"filter-points-multiplier", no_argument, 0, 'm'},
|
||||||
|
{"preserve-input-order", no_argument, 0, 'o' & 0x1F},
|
||||||
|
{"accumulate-attribute", required_argument, 0, 'E'},
|
||||||
{"unidecode-data", required_argument, 0, '~'},
|
{"unidecode-data", required_argument, 0, '~'},
|
||||||
|
|
||||||
{0, 0, 0, 0},
|
{0, 0, 0, 0},
|
||||||
@@ -1402,6 +1415,18 @@ int main(int argc, char **argv) {
|
|||||||
quiet = true;
|
quiet = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'm':
|
||||||
|
demultiply = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'o' & 0x1F:
|
||||||
|
preserve_input_order = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'E':
|
||||||
|
set_attribute_accum(attribute_accum, optarg, argv);
|
||||||
|
break;
|
||||||
|
|
||||||
case '~': {
|
case '~': {
|
||||||
const char *opt = long_options[option_index].name;
|
const char *opt = long_options[option_index].name;
|
||||||
if (strcmp(opt, "tile-stats-attributes-limit") == 0) {
|
if (strcmp(opt, "tile-stats-attributes-limit") == 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user