mirror of
https://github.com/felt/tippecanoe.git
synced 2026-11-24 09:21:18 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cbf222754b | ||
|
|
f957f30f90 | ||
|
|
679a0d62f2 | ||
|
|
5d92a17193 |
@@ -1,3 +1,19 @@
|
||||
# 2.41.2
|
||||
|
||||
* Add --accumulate-attribute to tippecanoe-overzoom
|
||||
* Go back to ordering features within each multiplier cluster spatially, not in the order specified for tile feature order
|
||||
|
||||
# 2.41.1
|
||||
|
||||
* Make --preserve-input-order, --order-by, --order-descending-by, --order-smallest-first, and --order-largest-first cooperate with --retain-points-multiplier. The clusters will be ordered by their lead feature in the specified sequence. The other features in each cluster will continue to be physically near the lead feature, but ordered as specified within the cluster.
|
||||
|
||||
# 2.41.0
|
||||
|
||||
* Add Felt-style expression support for -j feature filters
|
||||
* Add --retain-points-multiplier option
|
||||
* Add tippecanoe_decisions metadata field to record basezoom, drop rate, and multiplier
|
||||
* Add multiplier thinning (-m) and feature filters (-j) to tippecanoe-overzoom
|
||||
|
||||
# 2.40.0
|
||||
|
||||
* Slightly reduce compression aggressiveness to improve as-needed dropping speed
|
||||
|
||||
@@ -58,7 +58,7 @@ C = $(wildcard *.c) $(wildcard *.cpp)
|
||||
INCLUDES = -I/usr/local/include -I.
|
||||
LIBS = -L/usr/local/lib
|
||||
|
||||
tippecanoe: geojson.o jsonpull/jsonpull.o tile.o pool.o mbtiles.o geometry.o projection.o memfile.o mvt.o serial.o main.o text.o dirtiles.o pmtiles_file.o plugin.o read_json.o write_json.o geobuf.o flatgeobuf.o evaluator.o geocsv.o csv.o geojson-loop.o json_logger.o visvalingam.o compression.o clip.o sort.o
|
||||
tippecanoe: geojson.o jsonpull/jsonpull.o tile.o pool.o mbtiles.o geometry.o projection.o memfile.o mvt.o serial.o main.o text.o dirtiles.o pmtiles_file.o plugin.o read_json.o write_json.o geobuf.o flatgeobuf.o evaluator.o geocsv.o csv.o geojson-loop.o json_logger.o visvalingam.o compression.o clip.o sort.o attribute.o
|
||||
$(CXX) $(PG) $(LIBS) $(FINAL_FLAGS) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) -lm -lz -lsqlite3 -lpthread
|
||||
|
||||
tippecanoe-enumerate: enumerate.o
|
||||
@@ -67,7 +67,7 @@ tippecanoe-enumerate: enumerate.o
|
||||
tippecanoe-decode: decode.o projection.o mvt.o write_json.o text.o jsonpull/jsonpull.o dirtiles.o pmtiles_file.o
|
||||
$(CXX) $(PG) $(LIBS) $(FINAL_FLAGS) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) -lm -lz -lsqlite3
|
||||
|
||||
tile-join: tile-join.o projection.o mbtiles.o mvt.o memfile.o dirtiles.o jsonpull/jsonpull.o text.o evaluator.o csv.o write_json.o pmtiles_file.o clip.o
|
||||
tile-join: tile-join.o projection.o mbtiles.o mvt.o memfile.o dirtiles.o jsonpull/jsonpull.o text.o evaluator.o csv.o write_json.o pmtiles_file.o clip.o attribute.o
|
||||
$(CXX) $(PG) $(LIBS) $(FINAL_FLAGS) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) -lm -lz -lsqlite3 -lpthread
|
||||
|
||||
tippecanoe-json-tool: jsontool.o jsonpull/jsonpull.o csv.o text.o geojson-loop.o
|
||||
@@ -76,7 +76,7 @@ tippecanoe-json-tool: jsontool.o jsonpull/jsonpull.o csv.o text.o geojson-loop.o
|
||||
unit: unit.o text.o sort.o mvt.o
|
||||
$(CXX) $(PG) $(LIBS) $(FINAL_FLAGS) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) -lm -lz -lsqlite3 -lpthread
|
||||
|
||||
tippecanoe-overzoom: overzoom.o mvt.o clip.o
|
||||
tippecanoe-overzoom: overzoom.o mvt.o clip.o evaluator.o jsonpull/jsonpull.o text.o attribute.o
|
||||
$(CXX) $(PG) $(LIBS) $(FINAL_FLAGS) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) -lm -lz -lsqlite3 -lpthread
|
||||
|
||||
-include $(wildcard *.d)
|
||||
@@ -287,6 +287,48 @@ overzoom-test: tippecanoe-overzoom
|
||||
./tippecanoe-overzoom -o tests/pbf/14-2616-6331.pbf tests/pbf/11-327-791.pbf 11/327/791 14/2616/6331
|
||||
cmp tests/pbf/14-2616-6331.pbf /dev/null
|
||||
rm tests/pbf/14-2616-6331.pbf
|
||||
# Thinning
|
||||
# 243 features in the source tile tests/pbf/0-0-0-pop.pbf
|
||||
# 9 of them survive as the best of each cluster of 30
|
||||
# ./tippecanoe -z1 -r30 --retain-points-multiplier 30 -f -e out.dir tests/ne_110m_populated_places/in.json
|
||||
# cp out.dir/0/0/0.pbf tests/pbf/0-0-0-pop.pbf
|
||||
./tippecanoe-overzoom -y NAME -m -o tests/pbf/0-0-0-pop-filtered.pbf tests/pbf/0-0-0-pop.pbf 0/0/0 0/0/0
|
||||
./tippecanoe-decode tests/pbf/0-0-0-pop-filtered.pbf 0 0 0 > tests/pbf/0-0-0-pop-filtered.pbf.json.check
|
||||
cmp tests/pbf/0-0-0-pop-filtered.pbf.json.check tests/pbf/0-0-0-pop-filtered.pbf.json
|
||||
rm tests/pbf/0-0-0-pop-filtered.pbf tests/pbf/0-0-0-pop-filtered.pbf.json.check
|
||||
# Thinning with accumulation
|
||||
./tippecanoe-overzoom -y NAME -m --accumulate-attribute NAME:comma -o tests/pbf/0-0-0-pop-accum.pbf tests/pbf/0-0-0-pop.pbf 0/0/0 0/0/0
|
||||
./tippecanoe-decode tests/pbf/0-0-0-pop-accum.pbf 0 0 0 > tests/pbf/0-0-0-pop-accum.pbf.json.check
|
||||
cmp tests/pbf/0-0-0-pop-accum.pbf.json.check tests/pbf/0-0-0-pop-accum.pbf.json
|
||||
rm tests/pbf/0-0-0-pop-accum.pbf tests/pbf/0-0-0-pop-accum.pbf.json.check
|
||||
# Filtering
|
||||
# 243 features in the source tile tests/pbf/0-0-0-pop.pbf
|
||||
# 27 of them match the filter and are retained
|
||||
./tippecanoe-overzoom -y NAME -j'{"*":["SCALERANK","eq",0]}' -o tests/pbf/0-0-0-pop-expr.pbf tests/pbf/0-0-0-pop.pbf 0/0/0 0/0/0
|
||||
./tippecanoe-decode tests/pbf/0-0-0-pop-expr.pbf 0 0 0 > tests/pbf/0-0-0-pop-expr.pbf.json.check
|
||||
cmp tests/pbf/0-0-0-pop-expr.pbf.json.check tests/pbf/0-0-0-pop-expr.pbf.json
|
||||
rm tests/pbf/0-0-0-pop-expr.pbf tests/pbf/0-0-0-pop-expr.pbf.json.check
|
||||
# Filtering with multiplier
|
||||
# 243 features in the source tile tests/pbf/0-0-0-pop.pbf
|
||||
# 8 features survive into the output, from 9 clusters of 30
|
||||
./tippecanoe-overzoom -y NAME -y SCALERANK -j'{"*":["SCALERANK","eq",0]}' -m -o tests/pbf/0-0-0-filter-mult.pbf tests/pbf/0-0-0-pop.pbf 0/0/0 0/0/0
|
||||
./tippecanoe-decode tests/pbf/0-0-0-filter-mult.pbf 0 0 0 > tests/pbf/0-0-0-filter-mult.pbf.json.check
|
||||
cmp tests/pbf/0-0-0-filter-mult.pbf.json.check tests/pbf/0-0-0-filter-mult.pbf.json
|
||||
rm tests/pbf/0-0-0-filter-mult.pbf tests/pbf/0-0-0-filter-mult.pbf.json.check
|
||||
# Filtering with multiplier and preserve-input-order
|
||||
# 243 features in the source tile tests/pbf/0-0-0-pop.pbf
|
||||
./tippecanoe-overzoom -y NAME -y SCALERANK -j'{"*":["NAME","cn","e"]}' -m --preserve-input-order -o tests/pbf/0-0-0-filter-mult-order.pbf tests/pbf/0-0-0-pop.pbf 0/0/0 0/0/0
|
||||
./tippecanoe-decode tests/pbf/0-0-0-filter-mult-order.pbf 0 0 0 > tests/pbf/0-0-0-filter-mult-order.pbf.json.check
|
||||
cmp tests/pbf/0-0-0-filter-mult-order.pbf.json.check tests/pbf/0-0-0-filter-mult-order.pbf.json
|
||||
rm tests/pbf/0-0-0-filter-mult-order.pbf tests/pbf/0-0-0-filter-mult-order.pbf.json.check
|
||||
# Test that overzooming with a multiplier exactly reverses the effect of tiling with a multiplier
|
||||
./tippecanoe -q -z5 --preserve-point-density-threshold 8 --retain-points-multiplier 3 -f -e tests/muni/out/out.dir tests/muni/muni.json
|
||||
./tippecanoe -q -z5 --preserve-point-density-threshold 8 -f -o tests/muni/out/out.mbtiles tests/muni/muni.json
|
||||
./tippecanoe-overzoom -m -o tests/muni/out/out.dir/000.pbf tests/muni/out/out.dir/0/0/0.pbf 0/0/0 0/0/0
|
||||
./tippecanoe-decode tests/muni/out/out.mbtiles 0 0 0 > tests/muni/out/out.dir/direct.json
|
||||
./tippecanoe-decode tests/muni/out/out.dir/000.pbf 0 0 0 > tests/muni/out/out.dir/overzoomed.json
|
||||
cmp tests/muni/out/out.dir/overzoomed.json tests/muni/out/out.dir/direct.json
|
||||
rm -rf tests/muni/out/out.dir tests/muni/out/out.mbtiles tests/muni/out/out.dir/overzoomed.json tests/muni/out/out.dir/direct.json
|
||||
|
||||
join-test: tippecanoe tippecanoe-decode tile-join
|
||||
./tippecanoe -q -f -z12 -o tests/join-population/tabblock_06001420.mbtiles -YALAND10:'Land area' -L'{"file": "tests/join-population/tabblock_06001420.json", "description": "population"}'
|
||||
|
||||
@@ -421,7 +421,7 @@ be reduced to the maximum that can be used with the specified _maxzoom_.
|
||||
|
||||
### Filtering features by attributes
|
||||
|
||||
* `-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. The special variable `$zoom` refers to the current zoom level.
|
||||
* `-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) or in a Felt filter specification still to be finalized) 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. The special variable `$zoom` refers to the current zoom level.
|
||||
* `-J` *filter-file* or `--feature-filter-file`=*filter-file*: Like `-j`, but read the filter from a file.
|
||||
|
||||
Example: to find the Natural Earth countries with low `scalerank` but high `LABELRANK`:
|
||||
@@ -459,6 +459,7 @@ the same layer, enclose them in an `all` expression so they will all be evaluate
|
||||
If you use `-Bg`, it will guess a zoom level that will keep at most 50,000 features in the densest tile.
|
||||
You can also specify a marker-width with `-Bg`*width* to allow fewer features in the densest tile to
|
||||
compensate for the larger marker, or `-Bf`*number* to allow at most *number* features in the densest tile.
|
||||
* `--retain-points-multiplier=`_multiple_: Retain the specified multiple of points instead of just the number of points that would ordinarily be retained by the drop rate. These can be thinned out later with the `-m` option to `tippecanoe-overzoom`. The start of each cluster is marked in the feature sequence by the `tippecanoe:retain_points_multiplier_first` attribute.
|
||||
* `--drop-denser=`_percentage_: When dropping dots at zoom levels below the base zoom, give the specified _percentage_
|
||||
preference to retaining points in sparse areas and dropping points in dense areas.
|
||||
* `--limit-base-zoom-to-maximum-zoom` or `-Pb`: Limit the guessed base zoom not to exceed the maxzoom, even if this would put more than the requested number of features in a base zoom tile.
|
||||
@@ -993,4 +994,7 @@ reads tile `inz/inx/iny` of `in.mvt.gz` and produces tile `outz/outx/outy` of `o
|
||||
* `-b` *buffer*: Set the tile buffer in the output tile (default 5)
|
||||
* `-d` *detail*: Set the detail of the output tile (default 12)
|
||||
* `-y` *attribute*: Retain the specified *attribute* in the output features. All attributes that are not named in a `-y` option will be removed.
|
||||
|
||||
* `-j` *filter*: Filter features using the same expression syntax as in tippecanoe.
|
||||
* `-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.
|
||||
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include "attribute.hpp"
|
||||
#include "errors.hpp"
|
||||
#include "serial.hpp"
|
||||
#include "jsonpull/jsonpull.h"
|
||||
#include "milo/dtoa_milo.h"
|
||||
|
||||
void set_attribute_accum(std::map<std::string, attribute_op> &attribute_accum, std::string name, std::string type) {
|
||||
attribute_op t;
|
||||
|
||||
if (type == "sum") {
|
||||
t = op_sum;
|
||||
} else if (type == "product") {
|
||||
t = op_product;
|
||||
} else if (type == "mean") {
|
||||
t = op_mean;
|
||||
} else if (type == "max") {
|
||||
t = op_max;
|
||||
} else if (type == "min") {
|
||||
t = op_min;
|
||||
} else if (type == "concat") {
|
||||
t = op_concat;
|
||||
} else if (type == "comma") {
|
||||
t = op_comma;
|
||||
} else {
|
||||
fprintf(stderr, "Attribute method (%s) must be sum, product, mean, max, min, concat, or comma\n", type.c_str());
|
||||
exit(EXIT_ARGS);
|
||||
}
|
||||
|
||||
attribute_accum.insert(std::pair<std::string, attribute_op>(name, t));
|
||||
}
|
||||
|
||||
void set_attribute_accum(std::map<std::string, attribute_op> &attribute_accum, const char *arg, char **argv) {
|
||||
if (*arg == '{') {
|
||||
json_pull *jp = json_begin_string(arg);
|
||||
json_object *o = json_read_tree(jp);
|
||||
|
||||
if (o == NULL) {
|
||||
fprintf(stderr, "%s: -E%s: %s\n", *argv, arg, jp->error);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
|
||||
if (o->type != JSON_HASH) {
|
||||
fprintf(stderr, "%s: -E%s: not a JSON object\n", *argv, arg);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < o->value.object.length; i++) {
|
||||
json_object *k = o->value.object.keys[i];
|
||||
json_object *v = o->value.object.values[i];
|
||||
|
||||
if (k->type != JSON_STRING) {
|
||||
fprintf(stderr, "%s: -E%s: key %zu not a string\n", *argv, arg, i);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
if (v->type != JSON_STRING) {
|
||||
fprintf(stderr, "%s: -E%s: value %zu not a string\n", *argv, arg, i);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
|
||||
set_attribute_accum(attribute_accum, k->value.string.string, v->value.string.string);
|
||||
}
|
||||
|
||||
json_free(o);
|
||||
json_end(jp);
|
||||
return;
|
||||
}
|
||||
|
||||
const char *s = strchr(arg, ':');
|
||||
if (s == NULL) {
|
||||
fprintf(stderr, "-E%s option must be in the form -Ename:method\n", arg);
|
||||
exit(EXIT_ARGS);
|
||||
}
|
||||
|
||||
std::string name = std::string(arg, s - arg);
|
||||
std::string type = std::string(s + 1);
|
||||
|
||||
set_attribute_accum(attribute_accum, name, type);
|
||||
}
|
||||
|
||||
void preserve_attribute(attribute_op op, std::string &key, serial_val &val, std::vector<std::string> &full_keys, std::vector<serial_val> &full_values, std::map<std::string, accum_state> &attribute_accum_state) {
|
||||
for (size_t i = 0; i < full_keys.size(); i++) {
|
||||
if (key == full_keys[i]) {
|
||||
switch (op) {
|
||||
case op_sum:
|
||||
full_values[i].s = milo::dtoa_milo(atof(full_values[i].s.c_str()) + atof(val.s.c_str()));
|
||||
full_values[i].type = mvt_double;
|
||||
break;
|
||||
|
||||
case op_product:
|
||||
full_values[i].s = milo::dtoa_milo(atof(full_values[i].s.c_str()) * atof(val.s.c_str()));
|
||||
full_values[i].type = mvt_double;
|
||||
break;
|
||||
|
||||
case op_max: {
|
||||
double existing = atof(full_values[i].s.c_str());
|
||||
double maybe = atof(val.s.c_str());
|
||||
if (maybe > existing) {
|
||||
full_values[i].s = val.s.c_str();
|
||||
full_values[i].type = mvt_double;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case op_min: {
|
||||
double existing = atof(full_values[i].s.c_str());
|
||||
double maybe = atof(val.s.c_str());
|
||||
if (maybe < existing) {
|
||||
full_values[i].s = val.s.c_str();
|
||||
full_values[i].type = mvt_double;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case op_mean: {
|
||||
auto state = attribute_accum_state.find(key);
|
||||
if (state == attribute_accum_state.end()) {
|
||||
accum_state s;
|
||||
s.sum = atof(full_values[i].s.c_str()) + atof(val.s.c_str());
|
||||
s.count = 2;
|
||||
attribute_accum_state.insert(std::pair<std::string, accum_state>(key, s));
|
||||
|
||||
full_values[i].s = milo::dtoa_milo(s.sum / s.count);
|
||||
} else {
|
||||
state->second.sum += atof(val.s.c_str());
|
||||
state->second.count += 1;
|
||||
|
||||
full_values[i].s = milo::dtoa_milo(state->second.sum / state->second.count);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case op_concat:
|
||||
full_values[i].s += val.s;
|
||||
full_values[i].type = mvt_string;
|
||||
break;
|
||||
|
||||
case op_comma:
|
||||
full_values[i].s += std::string(",") + val.s;
|
||||
full_values[i].type = mvt_string;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef ATTRIBUTE_HPP
|
||||
#define ATTRIBUTE_HPP
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
enum attribute_op {
|
||||
op_sum,
|
||||
op_product,
|
||||
op_mean,
|
||||
op_concat,
|
||||
op_comma,
|
||||
op_max,
|
||||
op_min,
|
||||
};
|
||||
|
||||
struct accum_state {
|
||||
double sum = 0;
|
||||
double count = 0;
|
||||
};
|
||||
|
||||
struct serial_val;
|
||||
|
||||
void set_attribute_accum(std::map<std::string, attribute_op> &attribute_accum, std::string name, std::string type);
|
||||
void set_attribute_accum(std::map<std::string, attribute_op> &attribute_accum, const char *arg, char **argv);
|
||||
void preserve_attribute(attribute_op op, std::string &key, serial_val &val, std::vector<std::string> &full_keys, std::vector<serial_val> &full_values, std::map<std::string, accum_state> &attribute_accum_state);
|
||||
|
||||
#endif
|
||||
@@ -7,6 +7,9 @@
|
||||
#include "errors.hpp"
|
||||
#include "compression.hpp"
|
||||
#include "mvt.hpp"
|
||||
#include "evaluator.hpp"
|
||||
#include "serial.hpp"
|
||||
#include "attribute.hpp"
|
||||
|
||||
static std::vector<std::pair<double, double>> clip_poly1(std::vector<std::pair<double, double>> &geom,
|
||||
long long minx, long long miny, long long maxx, long long maxy,
|
||||
@@ -754,7 +757,8 @@ static std::vector<std::pair<double, double>> clip_poly1(std::vector<std::pair<d
|
||||
|
||||
std::string overzoom(std::string s, int oz, int ox, int oy, int nz, int nx, int ny,
|
||||
int detail, int buffer, std::set<std::string> const &keep, bool do_compress,
|
||||
std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles) {
|
||||
std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles,
|
||||
bool demultiply, json_object *filter, bool preserve_input_order, std::map<std::string, attribute_op> const &attribute_accum) {
|
||||
mvt_tile tile;
|
||||
|
||||
try {
|
||||
@@ -768,12 +772,99 @@ std::string overzoom(std::string s, int oz, int ox, int oy, int nz, int nx, int
|
||||
exit(EXIT_PROTOBUF);
|
||||
}
|
||||
|
||||
return overzoom(tile, oz, ox, oy, nz, nx, ny, detail, buffer, keep, do_compress, next_overzoomed_tiles);
|
||||
return overzoom(tile, oz, ox, oy, nz, nx, ny, detail, buffer, keep, do_compress, next_overzoomed_tiles, demultiply, filter, preserve_input_order, attribute_accum);
|
||||
}
|
||||
|
||||
struct tile_feature {
|
||||
drawvec geom;
|
||||
int t;
|
||||
bool has_id;
|
||||
unsigned long long id;
|
||||
std::vector<unsigned> tags;
|
||||
mvt_layer const *layer;
|
||||
size_t seq = 0;
|
||||
};
|
||||
|
||||
static void feature_out(std::vector<tile_feature> const &features, mvt_layer &outlayer, std::set<std::string> const &keep, std::map<std::string, attribute_op> const &attribute_accum) {
|
||||
// Add geometry to output feature
|
||||
|
||||
mvt_feature outfeature;
|
||||
outfeature.type = features[0].t;
|
||||
for (auto const &g : features[0].geom) {
|
||||
outfeature.geometry.emplace_back(g.op, g.x, g.y);
|
||||
}
|
||||
|
||||
// ID and attributes, if it didn't get clipped away
|
||||
|
||||
if (outfeature.geometry.size() > 0) {
|
||||
if (features[0].has_id) {
|
||||
outfeature.has_id = true;
|
||||
outfeature.id = features[0].id;
|
||||
}
|
||||
|
||||
outfeature.seq = features[0].seq;
|
||||
|
||||
if (attribute_accum.size() > 0) {
|
||||
// convert the attributes of the output feature
|
||||
// from mvt_value to serial_val so they can have
|
||||
// attributes from the other features of the
|
||||
// multiplier cluster accumulated onto them
|
||||
|
||||
std::map<std::string, accum_state> attribute_accum_state;
|
||||
std::vector<std::string> full_keys;
|
||||
std::vector<serial_val> full_values;
|
||||
|
||||
for (size_t i = 0; i + 1 < features[0].tags.size(); i += 2) {
|
||||
full_keys.push_back(features[0].layer->keys[features[0].tags[i]]);
|
||||
full_values.push_back(mvt_value_to_serial_val(features[0].layer->values[features[0].tags[i + 1]]));
|
||||
}
|
||||
|
||||
// accumulate whatever attributes are specified to be accumulated
|
||||
// onto the feature that will survive into the output, from the
|
||||
// features that will not
|
||||
|
||||
for (size_t i = 1; i < features.size(); i++) {
|
||||
for (size_t j = 0; j + 1 < features[i].tags.size(); j += 2) {
|
||||
std::string key = features[i].layer->keys[features[i].tags[j]];
|
||||
|
||||
auto f = attribute_accum.find(key);
|
||||
if (f != attribute_accum.end()) {
|
||||
serial_val val = mvt_value_to_serial_val(features[i].layer->values[features[i].tags[j + 1]]);
|
||||
preserve_attribute(f->second, key, val, full_keys, full_values, attribute_accum_state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// convert the final attributes back to mvt_value
|
||||
// and tag them onto the output feature
|
||||
|
||||
for (size_t i = 0; i < full_keys.size(); i++) {
|
||||
if (keep.size() == 0 || keep.find(full_keys[i]) != keep.end()) {
|
||||
outlayer.tag(outfeature, full_keys[i], stringified_to_mvt_value(full_values[i].type, full_values[i].s.c_str()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (size_t i = 0; i + 1 < features[0].tags.size(); i += 2) {
|
||||
if (keep.size() == 0 || keep.find(features[0].layer->keys[features[0].tags[i]]) != keep.end()) {
|
||||
outlayer.tag(outfeature, features[0].layer->keys[features[0].tags[i]], features[0].layer->values[features[0].tags[i + 1]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
outlayer.features.push_back(outfeature);
|
||||
}
|
||||
}
|
||||
|
||||
static struct preservecmp {
|
||||
bool operator()(const mvt_feature &a, const mvt_feature &b) {
|
||||
return a.seq < b.seq;
|
||||
}
|
||||
} preservecmp;
|
||||
|
||||
std::string overzoom(mvt_tile tile, int oz, int ox, int oy, int nz, int nx, int ny,
|
||||
int detail, int buffer, std::set<std::string> const &keep, bool do_compress,
|
||||
std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles) {
|
||||
std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles,
|
||||
bool demultiply, json_object *filter, bool preserve_input_order, std::map<std::string, attribute_op> const &attribute_accum) {
|
||||
mvt_tile outtile;
|
||||
|
||||
for (auto const &layer : tile.layers) {
|
||||
@@ -788,8 +879,42 @@ std::string overzoom(mvt_tile tile, int oz, int ox, int oy, int nz, int nx, int
|
||||
outlayer.version = layer.version;
|
||||
outlayer.extent = 1LL << det;
|
||||
|
||||
for (auto const &feature : layer.features) {
|
||||
mvt_feature outfeature;
|
||||
std::vector<tile_feature> pending_tile_features;
|
||||
|
||||
for (auto feature : layer.features) {
|
||||
bool flush_multiplier_cluster = false;
|
||||
if (demultiply) {
|
||||
for (ssize_t i = feature.tags.size() - 2; i >= 0; i -= 2) {
|
||||
if (layer.keys[feature.tags[i]] == "tippecanoe:retain_points_multiplier_first") {
|
||||
mvt_value v = layer.values[feature.tags[i + 1]];
|
||||
if (v.type == mvt_bool && v.numeric_value.bool_value) {
|
||||
flush_multiplier_cluster = true;
|
||||
feature.tags.erase(feature.tags.begin() + i, feature.tags.begin() + i + 2);
|
||||
}
|
||||
}
|
||||
|
||||
if (layer.keys[feature.tags[i]] == "tippecanoe:retain_points_multiplier_sequence") {
|
||||
mvt_value v = layer.values[feature.tags[i + 1]];
|
||||
feature.seq = atoll(mvt_value_to_serial_val(v).s.c_str());
|
||||
feature.tags.erase(feature.tags.begin() + i, feature.tags.begin() + i + 2);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
flush_multiplier_cluster = true;
|
||||
}
|
||||
|
||||
if (flush_multiplier_cluster) {
|
||||
if (pending_tile_features.size() > 0) {
|
||||
feature_out(pending_tile_features, outlayer, keep, attribute_accum);
|
||||
pending_tile_features.clear();
|
||||
}
|
||||
}
|
||||
|
||||
std::set<std::string> exclude_attributes;
|
||||
if (!evaluate(feature, layer, filter, exclude_attributes, nz)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
drawvec geom;
|
||||
int t = feature.type;
|
||||
|
||||
@@ -862,29 +987,25 @@ std::string overzoom(mvt_tile tile, int oz, int ox, int oy, int nz, int nx, int
|
||||
geom = close_poly(geom);
|
||||
}
|
||||
|
||||
// Add geometry to output feature
|
||||
tile_feature tf;
|
||||
tf.geom = geom;
|
||||
tf.t = t;
|
||||
tf.has_id = feature.has_id;
|
||||
tf.id = feature.id;
|
||||
tf.tags = feature.tags;
|
||||
tf.layer = &layer;
|
||||
tf.seq = feature.seq;
|
||||
|
||||
outfeature.type = t;
|
||||
for (auto const &g : geom) {
|
||||
outfeature.geometry.emplace_back(g.op, g.x, g.y);
|
||||
}
|
||||
pending_tile_features.push_back(tf);
|
||||
}
|
||||
|
||||
// ID and attributes, if it didn't get clipped away
|
||||
if (pending_tile_features.size() > 0) {
|
||||
feature_out(pending_tile_features, outlayer, keep, attribute_accum);
|
||||
pending_tile_features.clear();
|
||||
}
|
||||
|
||||
if (outfeature.geometry.size() > 0) {
|
||||
if (feature.has_id) {
|
||||
outfeature.has_id = true;
|
||||
outfeature.id = feature.id;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i + 1 < feature.tags.size(); i += 2) {
|
||||
if (keep.size() == 0 || keep.find(layer.keys[feature.tags[i]]) != keep.end()) {
|
||||
outlayer.tag(outfeature, layer.keys[feature.tags[i]], layer.values[feature.tags[i + 1]]);
|
||||
}
|
||||
}
|
||||
|
||||
outlayer.features.push_back(outfeature);
|
||||
}
|
||||
if (preserve_input_order) {
|
||||
std::sort(outlayer.features.begin(), outlayer.features.end(), preservecmp);
|
||||
}
|
||||
|
||||
if (outlayer.features.size() > 0) {
|
||||
@@ -905,7 +1026,8 @@ std::string overzoom(mvt_tile tile, int oz, int ox, int oy, int nz, int nx, int
|
||||
for (size_t y = 0; y < 2; y++) {
|
||||
std::string child = overzoom(outtile, nz, nx, ny,
|
||||
nz + 1, nx * 2 + x, ny * 2 + y,
|
||||
detail, buffer, keep, false, NULL);
|
||||
detail, buffer, keep, false, NULL,
|
||||
demultiply, filter, preserve_input_order, attribute_accum);
|
||||
if (child.size() > 0) {
|
||||
next_overzoomed_tiles->emplace_back(nx * 2 + x, ny * 2 + y);
|
||||
}
|
||||
|
||||
@@ -318,6 +318,9 @@ void dir_write_metadata(const char *outdir, const metadata &m) {
|
||||
if (m.strategies_json.size() > 0) {
|
||||
out(state, "strategies", m.strategies_json);
|
||||
}
|
||||
if (m.decisions_json.size() > 0) {
|
||||
out(state, "tippecanoe_decisions", m.decisions_json);
|
||||
}
|
||||
out(state, "format", m.format);
|
||||
out(state, "generator", m.generator);
|
||||
out(state, "generator_options", m.generator_options);
|
||||
|
||||
+351
-14
@@ -5,6 +5,123 @@
|
||||
#include "mvt.hpp"
|
||||
#include "evaluator.hpp"
|
||||
#include "errors.hpp"
|
||||
#include "milo/dtoa_milo.h"
|
||||
|
||||
static std::string mvt_value_to_string(mvt_value one, bool &fail) {
|
||||
if (one.type == mvt_string) {
|
||||
return one.string_value;
|
||||
} else if (one.type == mvt_float) {
|
||||
return milo::dtoa_milo(one.numeric_value.float_value);
|
||||
} else if (one.type == mvt_double) {
|
||||
return milo::dtoa_milo(one.numeric_value.double_value);
|
||||
} else if (one.type == mvt_int) {
|
||||
return std::to_string(one.numeric_value.int_value);
|
||||
} else if (one.type == mvt_uint) {
|
||||
return std::to_string(one.numeric_value.uint_value);
|
||||
} else if (one.type == mvt_sint) {
|
||||
return std::to_string(one.numeric_value.sint_value);
|
||||
} else if (one.type == mvt_bool) {
|
||||
return one.numeric_value.bool_value ? "true" : "false";
|
||||
} else if (one.type == mvt_null) {
|
||||
fail = true; // null op string => null
|
||||
return "";
|
||||
} else {
|
||||
fprintf(stderr, "unhandled mvt_type %d\n", one.type);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
int compare_fsl(mvt_value one, json_object *two, bool &fail) {
|
||||
// In FSL expressions, the attribute value is coerced to the type
|
||||
// of the JSON literal value it is being compared to.
|
||||
//
|
||||
// If it cannot be converted, the comparison returns null
|
||||
// (which is distinct from true and false but is falsy if
|
||||
// it is the final output value).
|
||||
|
||||
if (two->type == JSON_NULL) {
|
||||
fail = true; // anything op null => null
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (two->type == JSON_NUMBER) {
|
||||
double lhs;
|
||||
|
||||
if (one.type == mvt_string) {
|
||||
char *endptr = NULL;
|
||||
const char *s = one.string_value.c_str();
|
||||
lhs = strtod(s, &endptr);
|
||||
if (endptr == s) {
|
||||
fail = true; // non-numeric-string op number => null
|
||||
return 0;
|
||||
}
|
||||
} else if (one.type == mvt_float) {
|
||||
lhs = one.numeric_value.float_value;
|
||||
} else if (one.type == mvt_double) {
|
||||
lhs = one.numeric_value.double_value;
|
||||
} else if (one.type == mvt_int) {
|
||||
lhs = one.numeric_value.int_value;
|
||||
} else if (one.type == mvt_uint) {
|
||||
lhs = one.numeric_value.uint_value;
|
||||
} else if (one.type == mvt_sint) {
|
||||
lhs = one.numeric_value.sint_value;
|
||||
} else if (one.type == mvt_bool) {
|
||||
lhs = one.numeric_value.bool_value;
|
||||
} else if (one.type == mvt_null) {
|
||||
fail = true; // null op number => null
|
||||
return 0;
|
||||
} else {
|
||||
fprintf(stderr, "unhandled mvt_type %d\n", one.type);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
if (lhs < two->value.number.number) {
|
||||
return -1;
|
||||
} else if (lhs > two->value.number.number) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (two->type == JSON_STRING) {
|
||||
std::string lhs = mvt_value_to_string(one, fail);
|
||||
|
||||
return strcmp(lhs.c_str(), two->value.string.string);
|
||||
}
|
||||
|
||||
if (two->type == JSON_TRUE || two->type == JSON_FALSE) {
|
||||
bool lhs;
|
||||
|
||||
if (one.type == mvt_string) {
|
||||
lhs = one.string_value.size() > 0;
|
||||
} else if (one.type == mvt_float) {
|
||||
lhs = one.numeric_value.float_value != 0;
|
||||
} else if (one.type == mvt_double) {
|
||||
lhs = one.numeric_value.double_value != 0;
|
||||
} else if (one.type == mvt_int) {
|
||||
lhs = one.numeric_value.int_value != 0;
|
||||
} else if (one.type == mvt_uint) {
|
||||
lhs = one.numeric_value.uint_value != 0;
|
||||
} else if (one.type == mvt_sint) {
|
||||
lhs = one.numeric_value.sint_value != 0;
|
||||
} else if (one.type == mvt_bool) {
|
||||
lhs = one.numeric_value.bool_value;
|
||||
} else if (one.type == mvt_null) {
|
||||
fail = true; // null op bool => null
|
||||
return 0;
|
||||
} else {
|
||||
fprintf(stderr, "unhandled mvt_type %d\n", one.type);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
bool rhs = two->type == JSON_TRUE;
|
||||
return lhs - rhs;
|
||||
}
|
||||
|
||||
fprintf(stderr, "unhandled JSON type %d\n", two->type);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
int compare(mvt_value one, json_object *two, bool &fail) {
|
||||
if (one.type == mvt_string) {
|
||||
@@ -70,7 +187,36 @@ int compare(mvt_value one, json_object *two, bool &fail) {
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
bool eval(std::map<std::string, mvt_value> const &feature, json_object *f, std::set<std::string> &exclude_attributes) {
|
||||
// 0: false
|
||||
// 1: true
|
||||
// -1: incomparable (sql null), treated as false in final output
|
||||
static int eval(std::map<std::string, mvt_value> const &feature, json_object *f, std::set<std::string> &exclude_attributes) {
|
||||
if (f != NULL) {
|
||||
if (f->type == JSON_TRUE) {
|
||||
return 1;
|
||||
} else if (f->type == JSON_FALSE) {
|
||||
return 0;
|
||||
} else if (f->type == JSON_NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (f->type == JSON_NUMBER) {
|
||||
if (f->value.number.number == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (f->type == JSON_STRING) {
|
||||
if (f->value.string.string[0] == '\0') {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (f == NULL || f->type != JSON_ARRAY) {
|
||||
fprintf(stderr, "Filter is not an array: %s\n", json_stringify(f));
|
||||
exit(EXIT_FILTER);
|
||||
@@ -81,6 +227,149 @@ bool eval(std::map<std::string, mvt_value> const &feature, json_object *f, std::
|
||||
exit(EXIT_FILTER);
|
||||
}
|
||||
|
||||
// FSL conjunctions
|
||||
if (f->value.array.length == 3 &&
|
||||
f->value.array.array[1]->type == JSON_STRING &&
|
||||
(strcmp(f->value.array.array[1]->value.string.string, "or") == 0 ||
|
||||
strcmp(f->value.array.array[1]->value.string.string, "and") == 0)) {
|
||||
int lhs;
|
||||
|
||||
if (f->value.array.array[0]->type == JSON_STRING) {
|
||||
// if LHS of a boolean conjunction is a string, it is an attribute reference
|
||||
auto ff = feature.find(std::string(f->value.array.array[0]->value.string.string));
|
||||
if (ff != feature.end()) {
|
||||
if (ff->second.type == mvt_bool) {
|
||||
lhs = ff->second.numeric_value.bool_value;
|
||||
} else {
|
||||
lhs = -1; // not boolean: null
|
||||
}
|
||||
} else {
|
||||
lhs = -1; // not found: null
|
||||
}
|
||||
} else {
|
||||
lhs = eval(feature, f->value.array.array[0], exclude_attributes);
|
||||
}
|
||||
|
||||
int rhs = eval(feature, f->value.array.array[2], exclude_attributes);
|
||||
if (lhs < 0 && rhs < 0) {
|
||||
return -1; // null op null => null
|
||||
}
|
||||
if (strcmp(f->value.array.array[1]->value.string.string, "or") == 0) {
|
||||
return (lhs > 0) || (rhs > 0);
|
||||
} else {
|
||||
return (lhs > 0) && (rhs > 0);
|
||||
}
|
||||
}
|
||||
|
||||
// FSL comparators
|
||||
if (f->value.array.length == 3 &&
|
||||
f->value.array.array[0]->type == JSON_STRING &&
|
||||
f->value.array.array[1]->type == JSON_STRING &&
|
||||
(strcmp(f->value.array.array[1]->value.string.string, "lt") == 0 ||
|
||||
strcmp(f->value.array.array[1]->value.string.string, "gt") == 0 ||
|
||||
strcmp(f->value.array.array[1]->value.string.string, "le") == 0 ||
|
||||
strcmp(f->value.array.array[1]->value.string.string, "ge") == 0 ||
|
||||
strcmp(f->value.array.array[1]->value.string.string, "eq") == 0 ||
|
||||
strcmp(f->value.array.array[1]->value.string.string, "ne") == 0 ||
|
||||
strcmp(f->value.array.array[1]->value.string.string, "cn") == 0 ||
|
||||
strcmp(f->value.array.array[1]->value.string.string, "nc") == 0 ||
|
||||
strcmp(f->value.array.array[1]->value.string.string, "in") == 0 ||
|
||||
strcmp(f->value.array.array[1]->value.string.string, "ni") == 0 ||
|
||||
strcmp(f->value.array.array[1]->value.string.string, "is") == 0 ||
|
||||
strcmp(f->value.array.array[1]->value.string.string, "isnt") == 0 ||
|
||||
false)) {
|
||||
mvt_value lhs;
|
||||
lhs.type = mvt_null; // attributes that aren't found are nulls
|
||||
auto ff = feature.find(std::string(f->value.array.array[0]->value.string.string));
|
||||
if (ff != feature.end()) {
|
||||
lhs = ff->second;
|
||||
}
|
||||
|
||||
if (f->value.array.array[2]->type == JSON_NULL && strcmp(f->value.array.array[1]->value.string.string, "is") == 0) {
|
||||
return lhs.type == mvt_null; // null is null => true, anything is null => false
|
||||
}
|
||||
if (f->value.array.array[2]->type == JSON_NULL && strcmp(f->value.array.array[1]->value.string.string, "isnt") == 0) {
|
||||
return lhs.type != mvt_null; // null isnt null => false, anything isnt null => true
|
||||
}
|
||||
|
||||
if (lhs.type == mvt_null) {
|
||||
return -1; // null op anything => null
|
||||
}
|
||||
|
||||
bool fail = false;
|
||||
|
||||
if (f->value.array.array[2]->type == JSON_STRING &&
|
||||
(strcmp(f->value.array.array[1]->value.string.string, "cn") == 0 ||
|
||||
strcmp(f->value.array.array[1]->value.string.string, "nc") == 0)) {
|
||||
std::string s = mvt_value_to_string(lhs, fail);
|
||||
if (fail) {
|
||||
return -1; // null cn anything => false
|
||||
}
|
||||
|
||||
bool contains = strstr(s.c_str(), f->value.array.array[2]->value.string.string);
|
||||
if (strcmp(f->value.array.array[1]->value.string.string, "cn") == 0) {
|
||||
return contains;
|
||||
} else {
|
||||
return !contains;
|
||||
}
|
||||
}
|
||||
|
||||
if (f->value.array.array[2]->type == JSON_ARRAY &&
|
||||
(strcmp(f->value.array.array[1]->value.string.string, "in") == 0 ||
|
||||
strcmp(f->value.array.array[1]->value.string.string, "ni") == 0)) {
|
||||
std::string s = mvt_value_to_string(lhs, fail);
|
||||
if (fail) {
|
||||
return -1; // null in anything => false
|
||||
}
|
||||
|
||||
bool contains = false;
|
||||
for (size_t i = 0; i < f->value.array.array[2]->value.array.length; i++) {
|
||||
if (f->value.array.array[2]->value.array.array[i]->type != JSON_STRING) {
|
||||
return -1; // anything in [not-a-string] => null
|
||||
}
|
||||
|
||||
if (s == f->value.array.array[2]->value.array.array[i]->value.string.string) {
|
||||
contains = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(f->value.array.array[1]->value.string.string, "in") == 0) {
|
||||
return contains;
|
||||
} else {
|
||||
return !contains;
|
||||
}
|
||||
}
|
||||
|
||||
int cmp = compare_fsl(ff->second, f->value.array.array[2], fail);
|
||||
if (fail) {
|
||||
printf("cast fail\n");
|
||||
return -1; // null
|
||||
}
|
||||
|
||||
if (strcmp(f->value.array.array[1]->value.string.string, "eq") == 0) {
|
||||
return cmp == 0;
|
||||
}
|
||||
if (strcmp(f->value.array.array[1]->value.string.string, "ne") == 0) {
|
||||
return cmp != 0;
|
||||
}
|
||||
if (strcmp(f->value.array.array[1]->value.string.string, "gt") == 0) {
|
||||
return cmp > 0;
|
||||
}
|
||||
if (strcmp(f->value.array.array[1]->value.string.string, "ge") == 0) {
|
||||
return cmp >= 0;
|
||||
}
|
||||
if (strcmp(f->value.array.array[1]->value.string.string, "lt") == 0) {
|
||||
return cmp < 0;
|
||||
}
|
||||
if (strcmp(f->value.array.array[1]->value.string.string, "le") == 0) {
|
||||
return cmp <= 0;
|
||||
}
|
||||
|
||||
fprintf(stderr, "expression fsl comparison: can't happen %s\n", f->value.array.array[1]->value.string.string);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
if (f->value.array.array[0]->type != JSON_STRING) {
|
||||
fprintf(stderr, "Filter operation is not a string: %s\n", json_stringify(f));
|
||||
exit(EXIT_FILTER);
|
||||
@@ -192,17 +481,19 @@ bool eval(std::map<std::string, mvt_value> const &feature, json_object *f, std::
|
||||
}
|
||||
|
||||
for (size_t i = 1; i < f->value.array.length; i++) {
|
||||
bool out = eval(feature, f->value.array.array[i], exclude_attributes);
|
||||
int out = eval(feature, f->value.array.array[i], exclude_attributes);
|
||||
|
||||
if (strcmp(f->value.array.array[0]->value.string.string, "all") == 0) {
|
||||
v = v && out;
|
||||
if (!v) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
v = v || out;
|
||||
if (v) {
|
||||
break;
|
||||
if (out >= 0) { // nulls are ignored in boolean and/or expressions
|
||||
if (strcmp(f->value.array.array[0]->value.string.string, "all") == 0) {
|
||||
v = v && out;
|
||||
if (!v) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
v = v || out;
|
||||
if (v) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -281,7 +572,7 @@ bool eval(std::map<std::string, mvt_value> const &feature, json_object *f, std::
|
||||
exit(EXIT_FILTER);
|
||||
}
|
||||
|
||||
bool ok = eval(feature, f->value.array.array[2], exclude_attributes);
|
||||
bool ok = eval(feature, f->value.array.array[2], exclude_attributes) > 0;
|
||||
if (!ok) {
|
||||
exclude_attributes.insert(f->value.array.array[1]->value.string.string);
|
||||
}
|
||||
@@ -304,12 +595,12 @@ bool evaluate(std::map<std::string, mvt_value> const &feature, std::string const
|
||||
|
||||
f = json_hash_get(filter, layer.c_str());
|
||||
if (ok && f != NULL) {
|
||||
ok = eval(feature, f, exclude_attributes);
|
||||
ok = eval(feature, f, exclude_attributes) > 0;
|
||||
}
|
||||
|
||||
f = json_hash_get(filter, "*");
|
||||
if (ok && f != NULL) {
|
||||
ok = eval(feature, f, exclude_attributes);
|
||||
ok = eval(feature, f, exclude_attributes) > 0;
|
||||
}
|
||||
|
||||
return ok;
|
||||
@@ -346,3 +637,49 @@ json_object *parse_filter(const char *s) {
|
||||
json_end(jp);
|
||||
return filter;
|
||||
}
|
||||
|
||||
bool evaluate(mvt_feature const &feat, mvt_layer const &layer, json_object *filter, std::set<std::string> &exclude_attributes, int z) {
|
||||
if (filter != NULL) {
|
||||
std::map<std::string, mvt_value> attributes;
|
||||
|
||||
for (size_t t = 0; t + 1 < feat.tags.size(); t += 2) {
|
||||
std::string key = layer.keys[feat.tags[t]];
|
||||
const mvt_value &val = layer.values[feat.tags[t + 1]];
|
||||
|
||||
attributes.insert(std::pair<std::string, mvt_value>(key, val));
|
||||
}
|
||||
|
||||
if (feat.has_id) {
|
||||
mvt_value v;
|
||||
v.type = mvt_uint;
|
||||
v.numeric_value.uint_value = feat.id;
|
||||
|
||||
attributes.insert(std::pair<std::string, mvt_value>("$id", v));
|
||||
}
|
||||
|
||||
mvt_value v;
|
||||
v.type = mvt_string;
|
||||
|
||||
if (feat.type == mvt_point) {
|
||||
v.string_value = "Point";
|
||||
} else if (feat.type == mvt_linestring) {
|
||||
v.string_value = "LineString";
|
||||
} else if (feat.type == mvt_polygon) {
|
||||
v.string_value = "Polygon";
|
||||
}
|
||||
|
||||
attributes.insert(std::pair<std::string, mvt_value>("$type", v));
|
||||
|
||||
mvt_value v2;
|
||||
v2.type = mvt_uint;
|
||||
v2.numeric_value.uint_value = z;
|
||||
|
||||
attributes.insert(std::pair<std::string, mvt_value>("$zoom", v2));
|
||||
|
||||
if (!evaluate(attributes, layer.name, filter, exclude_attributes)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -11,4 +11,6 @@ bool evaluate(std::map<std::string, mvt_value> const &feature, std::string const
|
||||
json_object *parse_filter(const char *s);
|
||||
json_object *read_filter(const char *fname);
|
||||
|
||||
bool evaluate(mvt_feature const &feat, mvt_layer const &layer, json_object *filter, std::set<std::string> &exclude_attributes, int z);
|
||||
|
||||
#endif
|
||||
|
||||
+8
-2
@@ -8,6 +8,8 @@
|
||||
#include <sqlite3.h>
|
||||
#include <stdio.h>
|
||||
#include <mvt.hpp>
|
||||
#include "jsonpull/jsonpull.h"
|
||||
#include "attribute.hpp"
|
||||
|
||||
#define VT_POINT 1
|
||||
#define VT_LINE 2
|
||||
@@ -100,10 +102,14 @@ double distance_from_line(long long point_x, long long point_y, long long segA_x
|
||||
|
||||
std::string overzoom(mvt_tile tile, int oz, int ox, int oy, int nz, int nx, int ny,
|
||||
int detail, int buffer, std::set<std::string> const &keep, bool do_compress,
|
||||
std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles);
|
||||
std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles,
|
||||
bool demultiply, json_object *filter, bool preserve_input_order,
|
||||
std::map<std::string, attribute_op> const &attribute_accum);
|
||||
|
||||
std::string overzoom(std::string s, int oz, int ox, int oy, int nz, int nx, int ny,
|
||||
int detail, int buffer, std::set<std::string> const &keep, bool do_compress,
|
||||
std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles);
|
||||
std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles,
|
||||
bool demultiply, json_object *filter, bool preserve_input_order,
|
||||
std::map<std::string, attribute_op> const &attribute_accum);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
#include "errors.hpp"
|
||||
#include "read_json.hpp"
|
||||
#include "sort.hpp"
|
||||
#include "attribute.hpp"
|
||||
|
||||
static int low_detail = 12;
|
||||
static int full_detail = -1;
|
||||
@@ -93,6 +94,7 @@ unsigned int drop_denser = 0;
|
||||
std::map<std::string, serial_val> set_attributes;
|
||||
unsigned long long preserve_point_density_threshold = 0;
|
||||
long long extend_zooms_max = 0;
|
||||
int retain_points_multiplier = 1;
|
||||
|
||||
std::vector<order_field> order_by;
|
||||
bool order_reverse;
|
||||
@@ -303,7 +305,6 @@ int calc_feature_minzoom(struct index *ix, struct drop_state *ds, int maxzoom, d
|
||||
for (ssize_t i = maxzoom; i >= 0; i--) {
|
||||
ds[i].seq++;
|
||||
}
|
||||
ssize_t chosen = maxzoom + 1;
|
||||
for (ssize_t i = maxzoom; i >= 0; i--) {
|
||||
if (ds[i].seq < 0) {
|
||||
feature_minzoom = i + 1;
|
||||
@@ -317,7 +318,6 @@ int calc_feature_minzoom(struct index *ix, struct drop_state *ds, int maxzoom, d
|
||||
ds[j].previndex = ix->ix;
|
||||
}
|
||||
|
||||
chosen = i + 1;
|
||||
break;
|
||||
} else {
|
||||
ds[i].seq -= ds[i].interval;
|
||||
@@ -330,7 +330,7 @@ int calc_feature_minzoom(struct index *ix, struct drop_state *ds, int maxzoom, d
|
||||
// we will go ahead and push it out.
|
||||
|
||||
if (preserve_point_density_threshold > 0) {
|
||||
for (ssize_t i = 0; i < chosen && i < maxzoom; i++) {
|
||||
for (ssize_t i = 0; i < feature_minzoom && i < maxzoom; i++) {
|
||||
if (ix->ix - ds[i].previndex > ((1LL << (32 - i)) / preserve_point_density_threshold) * ((1LL << (32 - i)) / preserve_point_density_threshold)) {
|
||||
feature_minzoom = i;
|
||||
|
||||
@@ -480,10 +480,10 @@ void do_read_parallel(char *map, long long len, long long initial_offset, const
|
||||
sst.resize(CPUS);
|
||||
|
||||
pthread_t pthreads[CPUS];
|
||||
std::vector<std::set<type_and_string> > file_subkeys;
|
||||
std::vector<std::set<serial_val> > file_subkeys;
|
||||
|
||||
for (size_t i = 0; i < CPUS; i++) {
|
||||
file_subkeys.push_back(std::set<type_and_string>());
|
||||
file_subkeys.push_back(std::set<serial_val>());
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < CPUS; i++) {
|
||||
@@ -2825,7 +2825,7 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
|
||||
ai->second.maxzoom = maxzoom;
|
||||
}
|
||||
|
||||
metadata m = make_metadata(fname, minzoom, maxzoom, minlat, minlon, maxlat, maxlon, minlat2, minlon2, maxlat2, maxlon2, midlat, midlon, attribution, merged_lm, true, description, !prevent[P_TILE_STATS], attribute_descriptions, "tippecanoe", commandline, strategies);
|
||||
metadata m = make_metadata(fname, minzoom, maxzoom, minlat, minlon, maxlat, maxlon, minlat2, minlon2, maxlat2, maxlon2, midlat, midlon, attribution, merged_lm, true, description, !prevent[P_TILE_STATS], attribute_descriptions, "tippecanoe", commandline, strategies, basezoom, droprate, retain_points_multiplier);
|
||||
if (outdb != NULL) {
|
||||
mbtiles_write_metadata(outdb, m, forcetable);
|
||||
} else {
|
||||
@@ -2872,79 +2872,6 @@ void set_attribute_type(std::map<std::string, int> &attribute_types, const char
|
||||
attribute_types.insert(std::pair<std::string, int>(name, t));
|
||||
}
|
||||
|
||||
void set_attribute_accum(std::map<std::string, attribute_op> &attribute_accum, std::string name, std::string type) {
|
||||
attribute_op t;
|
||||
|
||||
if (type == "sum") {
|
||||
t = op_sum;
|
||||
} else if (type == "product") {
|
||||
t = op_product;
|
||||
} else if (type == "mean") {
|
||||
t = op_mean;
|
||||
} else if (type == "max") {
|
||||
t = op_max;
|
||||
} else if (type == "min") {
|
||||
t = op_min;
|
||||
} else if (type == "concat") {
|
||||
t = op_concat;
|
||||
} else if (type == "comma") {
|
||||
t = op_comma;
|
||||
} else {
|
||||
fprintf(stderr, "Attribute method (%s) must be sum, product, mean, max, min, concat, or comma\n", type.c_str());
|
||||
exit(EXIT_ARGS);
|
||||
}
|
||||
|
||||
attribute_accum.insert(std::pair<std::string, attribute_op>(name, t));
|
||||
}
|
||||
|
||||
void set_attribute_accum(std::map<std::string, attribute_op> &attribute_accum, const char *arg) {
|
||||
if (*arg == '{') {
|
||||
json_pull *jp = json_begin_string(arg);
|
||||
json_object *o = json_read_tree(jp);
|
||||
|
||||
if (o == NULL) {
|
||||
fprintf(stderr, "%s: -E%s: %s\n", *av, arg, jp->error);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
|
||||
if (o->type != JSON_HASH) {
|
||||
fprintf(stderr, "%s: -E%s: not a JSON object\n", *av, arg);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < o->value.object.length; i++) {
|
||||
json_object *k = o->value.object.keys[i];
|
||||
json_object *v = o->value.object.values[i];
|
||||
|
||||
if (k->type != JSON_STRING) {
|
||||
fprintf(stderr, "%s: -E%s: key %zu not a string\n", *av, arg, i);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
if (v->type != JSON_STRING) {
|
||||
fprintf(stderr, "%s: -E%s: value %zu not a string\n", *av, arg, i);
|
||||
exit(EXIT_JSON);
|
||||
}
|
||||
|
||||
set_attribute_accum(attribute_accum, k->value.string.string, v->value.string.string);
|
||||
}
|
||||
|
||||
json_free(o);
|
||||
json_end(jp);
|
||||
return;
|
||||
}
|
||||
|
||||
const char *s = strchr(arg, ':');
|
||||
if (s == NULL) {
|
||||
fprintf(stderr, "-E%s option must be in the form -Ename:method\n", arg);
|
||||
exit(EXIT_ARGS);
|
||||
}
|
||||
|
||||
std::string name = std::string(arg, s - arg);
|
||||
std::string type = std::string(s + 1);
|
||||
|
||||
set_attribute_accum(attribute_accum, name, type);
|
||||
}
|
||||
|
||||
void set_attribute_value(const char *arg) {
|
||||
if (*arg == '{') {
|
||||
json_pull *jp = json_begin_string(arg);
|
||||
@@ -3150,6 +3077,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
{"Dropping a fixed fraction of features by zoom level", 0, 0, 0},
|
||||
{"drop-rate", required_argument, 0, 'r'},
|
||||
{"retain-points-multiplier", required_argument, 0, '~'},
|
||||
{"base-zoom", required_argument, 0, 'B'},
|
||||
{"drop-denser", required_argument, 0, '~'},
|
||||
{"limit-base-zoom-to-maximum-zoom", no_argument, &prevent[P_BASEZOOM_ABOVE_MAXZOOM], 1},
|
||||
@@ -3370,6 +3298,8 @@ int main(int argc, char **argv) {
|
||||
preserve_point_density_threshold = atoll_require(optarg, "Preserve point density threshold");
|
||||
} else if (strcmp(opt, "extend-zooms-if-still-dropping-maximum") == 0) {
|
||||
extend_zooms_max = atoll_require(optarg, "Maximum number by which to extend zooms");
|
||||
} else if (strcmp(opt, "retain-points-multiplier") == 0) {
|
||||
retain_points_multiplier = atoll_require(optarg, "Multiply the fraction of points retained by zoom level");
|
||||
} else {
|
||||
fprintf(stderr, "%s: Unrecognized option --%s\n", argv[0], opt);
|
||||
exit(EXIT_ARGS);
|
||||
@@ -3692,7 +3622,7 @@ int main(int argc, char **argv) {
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
set_attribute_accum(attribute_accum, optarg);
|
||||
set_attribute_accum(attribute_accum, optarg, argv);
|
||||
break;
|
||||
|
||||
default: {
|
||||
|
||||
@@ -62,6 +62,7 @@ extern size_t limit_tile_feature_count;
|
||||
extern size_t limit_tile_feature_count_at_maxzoom;
|
||||
extern std::map<std::string, serial_val> set_attributes;
|
||||
extern long long extend_zooms_max;
|
||||
extern int retain_points_multiplier;
|
||||
|
||||
struct order_field {
|
||||
std::string name;
|
||||
|
||||
+11
-1
@@ -526,7 +526,7 @@ The attributes and values may also be specified as JSON keys and values: \fB\fC\
|
||||
.SS Filtering features by attributes
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-j\fR \fIfilter\fP or \fB\fC\-\-feature\-filter\fR=\fIfilter\fP: Check features against a per\-layer filter (as defined in the Mapbox GL Style Specification \[la]https://docs.mapbox.com/mapbox-gl-js/style-spec/#other-filter\[ra]) and only include those that match. Any features in layers that have no filter specified will be passed through. Filters for the layer \fB\fC"*"\fR apply to all layers. The special variable \fB\fC$zoom\fR refers to the current zoom level.
|
||||
\fB\fC\-j\fR \fIfilter\fP or \fB\fC\-\-feature\-filter\fR=\fIfilter\fP: Check features against a per\-layer filter (as defined in the Mapbox GL Style Specification \[la]https://docs.mapbox.com/mapbox-gl-js/style-spec/#other-filter\[ra] or in a Felt filter specification still to be finalized) and only include those that match. Any features in layers that have no filter specified will be passed through. Filters for the layer \fB\fC"*"\fR apply to all layers. The special variable \fB\fC$zoom\fR refers to the current zoom level.
|
||||
.IP \(bu 2
|
||||
\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.
|
||||
.RE
|
||||
@@ -574,6 +574,8 @@ If you use \fB\fC\-Bg\fR, it will guess a zoom level that will keep at most 50,0
|
||||
You can also specify a marker\-width with \fB\fC\-Bg\fR\fIwidth\fP to allow fewer features in the densest tile to
|
||||
compensate for the larger marker, or \fB\fC\-Bf\fR\fInumber\fP to allow at most \fInumber\fP features in the densest tile.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-retain\-points\-multiplier=\fR\fImultiple\fP: Retain the specified multiple of points instead of just the number of points that would ordinarily be retained by the drop rate. These can be thinned out later with the \fB\fC\-m\fR option to \fB\fCtippecanoe\-overzoom\fR\&. The start of each cluster is marked in the feature sequence by the \fB\fCtippecanoe:retain_points_multiplier_first\fR attribute.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-drop\-denser=\fR\fIpercentage\fP: When dropping dots at zoom levels below the base zoom, give the specified \fIpercentage\fP
|
||||
preference to retaining points in sparse areas and dropping points in dense areas.
|
||||
.IP \(bu 2
|
||||
@@ -1260,4 +1262,12 @@ reads tile \fB\fCinz/inx/iny\fR of \fB\fCin.mvt.gz\fR and produces tile \fB\fCou
|
||||
\fB\fC\-d\fR \fIdetail\fP: Set the detail of the output tile (default 12)
|
||||
.IP \(bu 2
|
||||
\fB\fC\-y\fR \fIattribute\fP: Retain the specified \fIattribute\fP in the output features. All attributes that are not named in a \fB\fC\-y\fR option will be removed.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-j\fR \fIfilter\fP: Filter features using the same expression syntax as in tippecanoe.
|
||||
.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
|
||||
|
||||
+74
-50
@@ -7,6 +7,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sqlite3.h>
|
||||
#include <cmath>
|
||||
#include <climits>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <set>
|
||||
@@ -194,21 +196,21 @@ void mbtiles_erase_zoom(sqlite3 *outdb, int z) {
|
||||
}
|
||||
}
|
||||
|
||||
bool type_and_string::operator<(const type_and_string &o) const {
|
||||
if (string < o.string) {
|
||||
bool serial_val::operator<(const serial_val &o) const {
|
||||
if (s < o.s) {
|
||||
return true;
|
||||
}
|
||||
if (string == o.string && type < o.type) {
|
||||
if (s == o.s && type < o.type) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool type_and_string::operator!=(const type_and_string &o) const {
|
||||
bool serial_val::operator!=(const serial_val &o) const {
|
||||
if (type != o.type) {
|
||||
return true;
|
||||
}
|
||||
if (string != o.string) {
|
||||
if (s != o.s) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -259,7 +261,7 @@ void tilestats(std::map<std::string, layermap_entry> const &layermap1, size_t el
|
||||
state.nospace = true;
|
||||
state.json_write_string(geomtype);
|
||||
|
||||
size_t attrib_count = layer.second.file_keys.size();
|
||||
size_t attrib_count = layer.second.tilestats.size();
|
||||
if (attrib_count > max_tilestats_attributes) {
|
||||
attrib_count = max_tilestats_attributes;
|
||||
}
|
||||
@@ -275,7 +277,7 @@ void tilestats(std::map<std::string, layermap_entry> const &layermap1, size_t el
|
||||
state.json_write_array();
|
||||
|
||||
size_t attrs = 0;
|
||||
for (auto attribute : layer.second.file_keys) {
|
||||
for (auto attribute : layer.second.tilestats) {
|
||||
if (attrs == elements) {
|
||||
break;
|
||||
}
|
||||
@@ -336,15 +338,15 @@ void tilestats(std::map<std::string, layermap_entry> const &layermap1, size_t el
|
||||
vals++;
|
||||
|
||||
state.nospace = true;
|
||||
state.json_write_stringified(value.string);
|
||||
state.json_write_stringified(value.s);
|
||||
} else {
|
||||
std::string trunc = truncate16(value.string, 256);
|
||||
std::string trunc = truncate16(value.s, 256);
|
||||
|
||||
if (trunc.size() == value.string.size()) {
|
||||
if (trunc.size() == value.s.size()) {
|
||||
vals++;
|
||||
|
||||
state.nospace = true;
|
||||
state.json_write_string(value.string);
|
||||
state.json_write_string(value.s);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -601,6 +603,17 @@ void mbtiles_write_metadata(sqlite3 *db, const metadata &m, bool forcetable) {
|
||||
sqlite3_free(sql);
|
||||
}
|
||||
|
||||
if (m.decisions_json.size() > 0) {
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('tippecanoe_decisions', %Q);", m.decisions_json.c_str());
|
||||
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "set decisions: %s\n", err);
|
||||
if (!forcetable) {
|
||||
exit(EXIT_SQLITE);
|
||||
}
|
||||
}
|
||||
sqlite3_free(sql);
|
||||
}
|
||||
|
||||
if (m.vector_layers_json.size() > 0 || m.tilestats_json.size() > 0) {
|
||||
std::string json;
|
||||
json_writer state(&json);
|
||||
@@ -642,7 +655,7 @@ void mbtiles_write_metadata(sqlite3 *db, const metadata &m, bool forcetable) {
|
||||
}
|
||||
}
|
||||
|
||||
metadata make_metadata(const char *fname, int minzoom, int maxzoom, double minlat, double minlon, double maxlat, double maxlon, double minlat2, double minlon2, double maxlat2, double maxlon2, double midlat, double midlon, const char *attribution, std::map<std::string, layermap_entry> const &layermap, bool vector, const char *description, bool do_tilestats, std::map<std::string, std::string> const &attribute_descriptions, std::string const &program, std::string const &commandline, std::vector<strategy> const &strategies) {
|
||||
metadata make_metadata(const char *fname, int minzoom, int maxzoom, double minlat, double minlon, double maxlat, double maxlon, double minlat2, double minlon2, double maxlat2, double maxlon2, double midlat, double midlon, const char *attribution, std::map<std::string, layermap_entry> const &layermap, bool vector, const char *description, bool do_tilestats, std::map<std::string, std::string> const &attribute_descriptions, std::string const &program, std::string const &commandline, std::vector<strategy> const &strategies, int basezoom, double droprate, int retain_points_multiplier) {
|
||||
metadata m;
|
||||
|
||||
m.name = fname;
|
||||
@@ -677,6 +690,17 @@ metadata make_metadata(const char *fname, int minzoom, int maxzoom, double minla
|
||||
|
||||
m.strategies_json = stringify_strategies(strategies);
|
||||
|
||||
if (isinf(droprate)) {
|
||||
droprate = LLONG_MAX;
|
||||
}
|
||||
if (basezoom != maxzoom || droprate != 2.5 || retain_points_multiplier != 1) {
|
||||
m.decisions_json = std::string("{") +
|
||||
"\"basezoom\":" + milo::dtoa_milo(basezoom) + "," +
|
||||
"\"droprate\":" + milo::dtoa_milo(droprate) + "," +
|
||||
"\"retain_points_multiplier\":" + std::to_string(retain_points_multiplier) +
|
||||
std::string("}");
|
||||
}
|
||||
|
||||
if (vector) {
|
||||
{
|
||||
json_writer state(&m.vector_layers_json);
|
||||
@@ -690,7 +714,7 @@ metadata make_metadata(const char *fname, int minzoom, int maxzoom, double minla
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < lnames.size(); i++) {
|
||||
auto fk = layermap.find(lnames[i]);
|
||||
auto ts = layermap.find(lnames[i]);
|
||||
state.nospace = true;
|
||||
state.json_write_hash();
|
||||
|
||||
@@ -702,17 +726,17 @@ metadata make_metadata(const char *fname, int minzoom, int maxzoom, double minla
|
||||
state.nospace = true;
|
||||
state.json_write_string("description");
|
||||
state.nospace = true;
|
||||
state.json_write_string(fk->second.description);
|
||||
state.json_write_string(ts->second.description);
|
||||
|
||||
state.nospace = true;
|
||||
state.json_write_string("minzoom");
|
||||
state.nospace = true;
|
||||
state.json_write_signed(fk->second.minzoom);
|
||||
state.json_write_signed(ts->second.minzoom);
|
||||
|
||||
state.nospace = true;
|
||||
state.json_write_string("maxzoom");
|
||||
state.nospace = true;
|
||||
state.json_write_signed(fk->second.maxzoom);
|
||||
state.json_write_signed(ts->second.maxzoom);
|
||||
|
||||
state.nospace = true;
|
||||
state.json_write_string("fields");
|
||||
@@ -721,7 +745,7 @@ metadata make_metadata(const char *fname, int minzoom, int maxzoom, double minla
|
||||
|
||||
bool first = true;
|
||||
size_t attribute_count = 0;
|
||||
for (auto j = fk->second.file_keys.begin(); j != fk->second.file_keys.end(); ++j) {
|
||||
for (auto j = ts->second.tilestats.begin(); j != ts->second.tilestats.end(); ++j) {
|
||||
if (first) {
|
||||
first = false;
|
||||
}
|
||||
@@ -828,35 +852,35 @@ std::map<std::string, layermap_entry> merge_layermaps(std::vector<std::map<std::
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
for (auto fk = map->second.file_keys.begin(); fk != map->second.file_keys.end(); ++fk) {
|
||||
std::string attribname = fk->first;
|
||||
for (auto ts = map->second.tilestats.begin(); ts != map->second.tilestats.end(); ++ts) {
|
||||
std::string attribname = ts->first;
|
||||
if (trunc) {
|
||||
attribname = truncate16(attribname, 256);
|
||||
}
|
||||
|
||||
auto fk2 = out_entry->second.file_keys.find(attribname);
|
||||
auto ts2 = out_entry->second.tilestats.find(attribname);
|
||||
|
||||
if (fk2 == out_entry->second.file_keys.end()) {
|
||||
out_entry->second.file_keys.insert(std::pair<std::string, type_and_string_stats>(attribname, fk->second));
|
||||
if (ts2 == out_entry->second.tilestats.end()) {
|
||||
out_entry->second.tilestats.insert(std::pair<std::string, tilestat>(attribname, ts->second));
|
||||
} else {
|
||||
for (auto val : fk->second.sample_values) {
|
||||
auto pt = std::lower_bound(fk2->second.sample_values.begin(), fk2->second.sample_values.end(), val);
|
||||
if (pt == fk2->second.sample_values.end() || *pt != val) { // not found
|
||||
fk2->second.sample_values.insert(pt, val);
|
||||
for (auto val : ts->second.sample_values) {
|
||||
auto pt = std::lower_bound(ts2->second.sample_values.begin(), ts2->second.sample_values.end(), val);
|
||||
if (pt == ts2->second.sample_values.end() || *pt != val) { // not found
|
||||
ts2->second.sample_values.insert(pt, val);
|
||||
|
||||
if (fk2->second.sample_values.size() > max_tilestats_sample_values) {
|
||||
fk2->second.sample_values.pop_back();
|
||||
if (ts2->second.sample_values.size() > max_tilestats_sample_values) {
|
||||
ts2->second.sample_values.pop_back();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fk2->second.type |= fk->second.type;
|
||||
ts2->second.type |= ts->second.type;
|
||||
|
||||
if (fk->second.min < fk2->second.min) {
|
||||
fk2->second.min = fk->second.min;
|
||||
if (ts->second.min < ts2->second.min) {
|
||||
ts2->second.min = ts->second.min;
|
||||
}
|
||||
if (fk->second.max > fk2->second.max) {
|
||||
fk2->second.max = fk->second.max;
|
||||
if (ts->second.max > ts2->second.max) {
|
||||
ts2->second.max = ts->second.max;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -877,41 +901,41 @@ std::map<std::string, layermap_entry> merge_layermaps(std::vector<std::map<std::
|
||||
return out;
|
||||
}
|
||||
|
||||
void add_to_file_keys(std::map<std::string, type_and_string_stats> &file_keys, std::string const &attrib, type_and_string const &val) {
|
||||
void add_to_tilestats(std::map<std::string, tilestat> &tilestats, std::string const &attrib, serial_val const &val) {
|
||||
if (val.type == mvt_null) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto fka = file_keys.find(attrib);
|
||||
if (fka == file_keys.end()) {
|
||||
file_keys.insert(std::pair<std::string, type_and_string_stats>(attrib, type_and_string_stats()));
|
||||
fka = file_keys.find(attrib);
|
||||
auto tsa = tilestats.find(attrib);
|
||||
if (tsa == tilestats.end()) {
|
||||
tilestats.insert(std::pair<std::string, tilestat>(attrib, tilestat()));
|
||||
tsa = tilestats.find(attrib);
|
||||
}
|
||||
|
||||
if (fka == file_keys.end()) {
|
||||
if (tsa == tilestats.end()) {
|
||||
fprintf(stderr, "Can't happen (tilestats)\n");
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
if (val.type == mvt_double) {
|
||||
double d = atof(val.string.c_str());
|
||||
double d = atof(val.s.c_str());
|
||||
|
||||
if (d < fka->second.min) {
|
||||
fka->second.min = d;
|
||||
if (d < tsa->second.min) {
|
||||
tsa->second.min = d;
|
||||
}
|
||||
if (d > fka->second.max) {
|
||||
fka->second.max = d;
|
||||
if (d > tsa->second.max) {
|
||||
tsa->second.max = d;
|
||||
}
|
||||
}
|
||||
|
||||
auto pt = std::lower_bound(fka->second.sample_values.begin(), fka->second.sample_values.end(), val);
|
||||
if (pt == fka->second.sample_values.end() || *pt != val) { // not found
|
||||
fka->second.sample_values.insert(pt, val);
|
||||
auto pt = std::lower_bound(tsa->second.sample_values.begin(), tsa->second.sample_values.end(), val);
|
||||
if (pt == tsa->second.sample_values.end() || *pt != val) { // not found
|
||||
tsa->second.sample_values.insert(pt, val);
|
||||
|
||||
if (fka->second.sample_values.size() > max_tilestats_sample_values) {
|
||||
fka->second.sample_values.pop_back();
|
||||
if (tsa->second.sample_values.size() > max_tilestats_sample_values) {
|
||||
tsa->second.sample_values.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
fka->second.type |= (1 << val.type);
|
||||
tsa->second.type |= (1 << val.type);
|
||||
}
|
||||
|
||||
+6
-13
@@ -9,16 +9,8 @@ extern size_t max_tilestats_attributes;
|
||||
extern size_t max_tilestats_sample_values;
|
||||
extern size_t max_tilestats_values;
|
||||
|
||||
struct type_and_string {
|
||||
int type = 0;
|
||||
std::string string = "";
|
||||
|
||||
bool operator<(const type_and_string &o) const;
|
||||
bool operator!=(const type_and_string &o) const;
|
||||
};
|
||||
|
||||
struct type_and_string_stats {
|
||||
std::vector<type_and_string> sample_values = std::vector<type_and_string>(); // sorted
|
||||
struct tilestat {
|
||||
std::vector<serial_val> sample_values = std::vector<serial_val>(); // sorted
|
||||
double min = INFINITY;
|
||||
double max = -INFINITY;
|
||||
int type = 0;
|
||||
@@ -26,7 +18,7 @@ struct type_and_string_stats {
|
||||
|
||||
struct layermap_entry {
|
||||
size_t id = 0;
|
||||
std::map<std::string, type_and_string_stats> file_keys{};
|
||||
std::map<std::string, tilestat> tilestats{};
|
||||
int minzoom = 0;
|
||||
int maxzoom = 0;
|
||||
std::string description = "";
|
||||
@@ -66,6 +58,7 @@ struct metadata {
|
||||
|
||||
std::string vector_layers_json;
|
||||
std::string tilestats_json;
|
||||
std::string decisions_json;
|
||||
};
|
||||
|
||||
#include "tile.hpp"
|
||||
@@ -75,7 +68,7 @@ sqlite3 *mbtiles_open(char *dbname, char **argv, int forcetable);
|
||||
void mbtiles_write_tile(sqlite3 *outdb, int z, int tx, int ty, const char *data, int size);
|
||||
void mbtiles_erase_zoom(sqlite3 *outdb, int z);
|
||||
|
||||
metadata make_metadata(const char *fname, int minzoom, int maxzoom, double minlat, double minlon, double maxlat, double maxlon, double minlat2, double minlon2, double maxlat2, double maxlon2, double midlat, double midlon, const char *attribution, std::map<std::string, layermap_entry> const &layermap, bool vector, const char *description, bool do_tilestats, std::map<std::string, std::string> const &attribute_descriptions, std::string const &program, std::string const &commandline, std::vector<strategy> const &strategies);
|
||||
metadata make_metadata(const char *fname, int minzoom, int maxzoom, double minlat, double minlon, double maxlat, double maxlon, double minlat2, double minlon2, double maxlat2, double maxlon2, double midlat, double midlon, const char *attribution, std::map<std::string, layermap_entry> const &layermap, bool vector, const char *description, bool do_tilestats, std::map<std::string, std::string> const &attribute_descriptions, std::string const &program, std::string const &commandline, std::vector<strategy> const &strategies, int basezoom, double droprate, int retain_points_multiplier);
|
||||
void mbtiles_write_metadata(sqlite3 *db, const metadata &m, bool forcetable);
|
||||
|
||||
void mbtiles_close(sqlite3 *outdb, const char *pgm);
|
||||
@@ -83,7 +76,7 @@ void mbtiles_close(sqlite3 *outdb, const char *pgm);
|
||||
std::map<std::string, layermap_entry> merge_layermaps(std::vector<std::map<std::string, layermap_entry> > const &maps);
|
||||
std::map<std::string, layermap_entry> merge_layermaps(std::vector<std::map<std::string, layermap_entry> > const &maps, bool trunc);
|
||||
|
||||
void add_to_file_keys(std::map<std::string, type_and_string_stats> &file_keys, std::string const &layername, type_and_string const &val);
|
||||
void add_to_tilestats(std::map<std::string, tilestat> &tilestats, std::string const &layername, serial_val const &val);
|
||||
|
||||
unsigned long long fnv1a(std::string const &s);
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "protozero/pbf_writer.hpp"
|
||||
#include "milo/dtoa_milo.h"
|
||||
#include "errors.hpp"
|
||||
#include "serial.hpp"
|
||||
|
||||
mvt_geometry::mvt_geometry(int nop, long long nx, long long ny) {
|
||||
this->op = nop;
|
||||
@@ -620,6 +621,11 @@ bool is_unsigned_integer(const char *s, unsigned long long *v) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// This converts a serial_val-style attribute value to an mvt_value
|
||||
// to store in a tile. If the value is numeric, it tries to choose
|
||||
// the type (int, uint, sint, float, or double) that will give the
|
||||
// smallest representation in the tile without losing precision,
|
||||
// regardless of how the value was represented in the original source.
|
||||
mvt_value stringified_to_mvt_value(int type, const char *s) {
|
||||
mvt_value tv;
|
||||
|
||||
@@ -675,3 +681,43 @@ mvt_value stringified_to_mvt_value(int type, const char *s) {
|
||||
|
||||
return tv;
|
||||
}
|
||||
|
||||
// This converts a mvt_value attribute value from a tile back into
|
||||
// a serial_val for more convenient parsing and comparison without
|
||||
// having to handle all of the vector tile numeric types separately.
|
||||
// All numeric types are given the type mvt_double in the serial_val
|
||||
// whether the actual value is integer or floating point.
|
||||
serial_val mvt_value_to_serial_val(mvt_value const &v) {
|
||||
serial_val sv;
|
||||
|
||||
if (v.type == mvt_string) {
|
||||
sv.type = mvt_string;
|
||||
sv.s = v.string_value;
|
||||
} else if (v.type == mvt_float) {
|
||||
sv.type = mvt_double;
|
||||
sv.s = milo::dtoa_milo(v.numeric_value.float_value);
|
||||
} else if (v.type == mvt_double) {
|
||||
sv.type = mvt_double;
|
||||
sv.s = milo::dtoa_milo(v.numeric_value.double_value);
|
||||
} else if (v.type == mvt_int) {
|
||||
sv.type = mvt_double;
|
||||
sv.s = std::to_string(v.numeric_value.int_value);
|
||||
} else if (v.type == mvt_uint) {
|
||||
sv.type = mvt_double;
|
||||
sv.s = std::to_string(v.numeric_value.uint_value);
|
||||
} else if (v.type == mvt_sint) {
|
||||
sv.type = mvt_double;
|
||||
sv.s = std::to_string(v.numeric_value.sint_value);
|
||||
} else if (v.type == mvt_bool) {
|
||||
sv.type = mvt_bool;
|
||||
sv.s = v.numeric_value.bool_value ? "true" : "false";
|
||||
} else if (v.type == mvt_null) {
|
||||
sv.type = mvt_null;
|
||||
sv.s = "null";
|
||||
} else {
|
||||
fprintf(stderr, "unhandled mvt_type %d\n", v.type);
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
return sv;
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ struct mvt_feature {
|
||||
unsigned long long id = 0;
|
||||
bool has_id = false;
|
||||
bool dropped = false;
|
||||
size_t seq = 0; // used for ordering in overzoom
|
||||
|
||||
mvt_feature() {
|
||||
has_id = false;
|
||||
@@ -122,4 +123,7 @@ mvt_value stringified_to_mvt_value(int type, const char *s);
|
||||
|
||||
bool is_integer(const char *s, long long *v);
|
||||
bool is_unsigned_integer(const char *s, unsigned long long *v);
|
||||
|
||||
struct serial_val;
|
||||
serial_val mvt_value_to_serial_val(mvt_value const &v);
|
||||
#endif
|
||||
|
||||
+55
-2
@@ -6,12 +6,18 @@
|
||||
#include "errors.hpp"
|
||||
#include "mvt.hpp"
|
||||
#include "geometry.hpp"
|
||||
#include "evaluator.hpp"
|
||||
#include "attribute.hpp"
|
||||
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
|
||||
int detail = 12; // tippecanoe-style: mvt extent == 1 << detail
|
||||
int buffer = 5; // tippecanoe-style: mvt buffer == extent * buffer / 256;
|
||||
bool demultiply = false;
|
||||
std::string filter;
|
||||
bool preserve_input_order = false;
|
||||
std::map<std::string, attribute_op> attribute_accum;
|
||||
|
||||
std::set<std::string> keep;
|
||||
|
||||
@@ -25,7 +31,32 @@ int main(int argc, char **argv) {
|
||||
int i;
|
||||
const char *outfile = NULL;
|
||||
|
||||
while ((i = getopt(argc, argv, "y:o:d:b:")) != -1) {
|
||||
struct option long_options[] = {
|
||||
{"include", required_argument, 0, 'y'},
|
||||
{"full-detail", required_argument, 0, 'd'},
|
||||
{"buffer", required_argument, 0, 'b'},
|
||||
{"output", required_argument, 0, 'o'},
|
||||
{"filter-points-multiplier", no_argument, 0, 'm'},
|
||||
{"feature-filter", required_argument, 0, 'j'},
|
||||
{"preserve-input-order", no_argument, 0, 'o' & 0x1F},
|
||||
{"accumulate-attribute", required_argument, 0, 'E'},
|
||||
|
||||
{0, 0, 0, 0},
|
||||
};
|
||||
|
||||
std::string getopt_str;
|
||||
for (size_t lo = 0; long_options[lo].name != NULL; lo++) {
|
||||
if (long_options[lo].val > ' ') {
|
||||
getopt_str.push_back(long_options[lo].val);
|
||||
|
||||
if (long_options[lo].has_arg == required_argument) {
|
||||
getopt_str.push_back(':');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int option_index = 0;
|
||||
while ((i = getopt_long(argc, argv, getopt_str.c_str(), long_options, &option_index)) != -1) {
|
||||
switch (i) {
|
||||
case 'y':
|
||||
keep.insert(optarg);
|
||||
@@ -43,7 +74,24 @@ int main(int argc, char **argv) {
|
||||
buffer = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
demultiply = true;
|
||||
break;
|
||||
|
||||
case 'j':
|
||||
filter = optarg;
|
||||
break;
|
||||
|
||||
case 'o' & 0x1F:
|
||||
preserve_input_order = true;
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
set_attribute_accum(attribute_accum, optarg, argv);
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "Unrecognized flag -%c\n", i);
|
||||
usage(argv);
|
||||
}
|
||||
}
|
||||
@@ -91,7 +139,12 @@ int main(int argc, char **argv) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
std::string out = overzoom(tile, oz, ox, oy, nz, nx, ny, detail, buffer, keep, true, NULL);
|
||||
json_object *json_filter = NULL;
|
||||
if (filter.size() > 0) {
|
||||
json_filter = parse_filter(filter.c_str());
|
||||
}
|
||||
|
||||
std::string out = overzoom(tile, oz, ox, oy, nz, nx, ny, detail, buffer, keep, true, NULL, demultiply, json_filter, preserve_input_order, attribute_accum);
|
||||
fwrite(out.c_str(), sizeof(char), out.size(), f);
|
||||
fclose(f);
|
||||
|
||||
|
||||
+25
-25
@@ -241,24 +241,24 @@ std::vector<mvt_layer> parse_layers(int fd, int z, unsigned x, unsigned y, std::
|
||||
}
|
||||
}
|
||||
|
||||
auto fk = layermap.find(layername);
|
||||
if (fk == layermap.end()) {
|
||||
auto ts = layermap.find(layername);
|
||||
if (ts == layermap.end()) {
|
||||
fprintf(stderr, "Internal error: layer %s not found\n", layername.c_str());
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
if (z < fk->second.minzoom) {
|
||||
fk->second.minzoom = z;
|
||||
if (z < ts->second.minzoom) {
|
||||
ts->second.minzoom = z;
|
||||
}
|
||||
if (z > fk->second.maxzoom) {
|
||||
fk->second.maxzoom = z;
|
||||
if (z > ts->second.maxzoom) {
|
||||
ts->second.maxzoom = z;
|
||||
}
|
||||
|
||||
if (feature.type == mvt_point) {
|
||||
fk->second.points++;
|
||||
ts->second.points++;
|
||||
} else if (feature.type == mvt_linestring) {
|
||||
fk->second.lines++;
|
||||
ts->second.lines++;
|
||||
} else if (feature.type == mvt_polygon) {
|
||||
fk->second.polygons++;
|
||||
ts->second.polygons++;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < properties->value.object.length; i++) {
|
||||
@@ -274,11 +274,11 @@ std::vector<mvt_layer> parse_layers(int fd, int z, unsigned x, unsigned y, std::
|
||||
mvt_value v = stringified_to_mvt_value(tp, s.c_str());
|
||||
l->second.tag(feature, std::string(properties->value.object.keys[i]->value.string.string), v);
|
||||
|
||||
type_and_string attrib;
|
||||
serial_val attrib;
|
||||
attrib.type = tp;
|
||||
attrib.string = s;
|
||||
attrib.s = s;
|
||||
|
||||
add_to_file_keys(fk->second.file_keys, std::string(properties->value.object.keys[i]->value.string.string), attrib);
|
||||
add_to_tilestats(ts->second.tilestats, std::string(properties->value.object.keys[i]->value.string.string), attrib);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -478,27 +478,27 @@ serial_feature parse_feature(json_pull *jp, int z, unsigned x, unsigned y, std::
|
||||
}
|
||||
}
|
||||
|
||||
auto fk = layermap.find(layername);
|
||||
if (fk == layermap.end()) {
|
||||
auto ts = layermap.find(layername);
|
||||
if (ts == layermap.end()) {
|
||||
fprintf(stderr, "Internal error: layer %s not found\n", layername.c_str());
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
sf.layer = fk->second.id;
|
||||
sf.layer = ts->second.id;
|
||||
|
||||
if (z < fk->second.minzoom) {
|
||||
fk->second.minzoom = z;
|
||||
if (z < ts->second.minzoom) {
|
||||
ts->second.minzoom = z;
|
||||
}
|
||||
if (z > fk->second.maxzoom) {
|
||||
fk->second.maxzoom = z;
|
||||
if (z > ts->second.maxzoom) {
|
||||
ts->second.maxzoom = z;
|
||||
}
|
||||
|
||||
if (!postfilter) {
|
||||
if (sf.t == mvt_point) {
|
||||
fk->second.points++;
|
||||
ts->second.points++;
|
||||
} else if (sf.t == mvt_linestring) {
|
||||
fk->second.lines++;
|
||||
ts->second.lines++;
|
||||
} else if (sf.t == mvt_polygon) {
|
||||
fk->second.polygons++;
|
||||
ts->second.polygons++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -515,12 +515,12 @@ serial_feature parse_feature(json_pull *jp, int z, unsigned x, unsigned y, std::
|
||||
sf.full_keys.push_back(std::string(properties->value.object.keys[i]->value.string.string));
|
||||
sf.full_values.push_back(v);
|
||||
|
||||
type_and_string attrib;
|
||||
attrib.string = v.s;
|
||||
serial_val attrib;
|
||||
attrib.s = v.s;
|
||||
attrib.type = v.type;
|
||||
|
||||
if (!postfilter) {
|
||||
add_to_file_keys(fk->second.file_keys, std::string(properties->value.object.keys[i]->value.string.string), attrib);
|
||||
add_to_tilestats(ts->second.tilestats, std::string(properties->value.object.keys[i]->value.string.string), attrib);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,6 +103,13 @@ std::string metadata_to_pmtiles_json(metadata m) {
|
||||
state.json_write_string("strategies");
|
||||
state.json_write_json(m.strategies_json);
|
||||
}
|
||||
|
||||
if (m.decisions_json.size() > 0) {
|
||||
state.json_comma_newline();
|
||||
state.json_write_string("tippecanoe_decisions");
|
||||
state.json_write_json(m.decisions_json);
|
||||
}
|
||||
|
||||
out(state, "generator", m.generator);
|
||||
out(state, "generator_options", m.generator_options);
|
||||
|
||||
@@ -428,6 +435,12 @@ sqlite3 *pmtilesmeta2tmp(const char *fname, const char *pmtiles_map) {
|
||||
fprintf(stderr, "set %s in metadata: %s\n", key, err);
|
||||
}
|
||||
sqlite3_free(sql);
|
||||
} else if (strcmp(key, "tippecanoe_decisions") == 0 && o->value.object.values[i]->type == JSON_HASH) {
|
||||
sql = sqlite3_mprintf("INSERT INTO metadata (name, value) VALUES ('tippecanoe_decisions', %Q);", json_stringify(o->value.object.values[i]));
|
||||
if (sqlite3_exec(db, sql, NULL, NULL, &err) != SQLITE_OK) {
|
||||
fprintf(stderr, "set %s in metadata: %s\n", key, err);
|
||||
}
|
||||
sqlite3_free(sql);
|
||||
} else if (o->value.object.keys[i]->type != JSON_STRING || o->value.object.values[i]->type != JSON_STRING) {
|
||||
fprintf(stderr, "%s\n", key);
|
||||
fprintf(stderr, "%s: non-string in metadata\n", fname);
|
||||
|
||||
@@ -116,6 +116,10 @@ void parse_geometry(int t, json_object *j, drawvec &out, int op, const char *fna
|
||||
}
|
||||
}
|
||||
|
||||
// This is used to convert a JSON attribute value into a serial_val-style
|
||||
// type and stringified value. All numeric values, even if they are integers,
|
||||
// even integers that are too large to fit in a double but will still be
|
||||
// stringified with their original precision, are recorded here as mvt_double.
|
||||
void stringify_value(json_object *value, int &type, std::string &stringified, const char *reading, int line, json_object *feature) {
|
||||
if (value != NULL) {
|
||||
int vt = value->type;
|
||||
|
||||
+4
-18
@@ -187,7 +187,6 @@ std::string serialize_feature(serial_feature *sf, long long wx, long long wy) {
|
||||
#define FLAG_LAYER 7
|
||||
|
||||
#define FLAG_LABEL_POINT 6
|
||||
#define FLAG_SEQ 5
|
||||
#define FLAG_INDEX 4
|
||||
#define FLAG_EXTENT 3
|
||||
#define FLAG_ID 2
|
||||
@@ -197,7 +196,6 @@ std::string serialize_feature(serial_feature *sf, long long wx, long long wy) {
|
||||
long long layer = 0;
|
||||
layer |= sf->layer << FLAG_LAYER;
|
||||
layer |= (sf->label_point != 0) << FLAG_LABEL_POINT;
|
||||
layer |= (sf->seq != 0) << FLAG_SEQ;
|
||||
layer |= (sf->index != 0) << FLAG_INDEX;
|
||||
layer |= (sf->extent != 0) << FLAG_EXTENT;
|
||||
layer |= sf->has_id << FLAG_ID;
|
||||
@@ -205,9 +203,7 @@ std::string serialize_feature(serial_feature *sf, long long wx, long long wy) {
|
||||
layer |= sf->has_tippecanoe_maxzoom << FLAG_MAXZOOM;
|
||||
|
||||
serialize_long_long(s, layer);
|
||||
if (sf->seq != 0) {
|
||||
serialize_long_long(s, sf->seq);
|
||||
}
|
||||
serialize_long_long(s, sf->seq);
|
||||
if (sf->has_tippecanoe_minzoom) {
|
||||
serialize_int(s, sf->tippecanoe_minzoom);
|
||||
}
|
||||
@@ -252,9 +248,7 @@ serial_feature deserialize_feature(std::string &geoms, unsigned z, unsigned tx,
|
||||
deserialize_long_long(&cp, &sf.layer);
|
||||
|
||||
sf.seq = 0;
|
||||
if (sf.layer & (1 << FLAG_SEQ)) {
|
||||
deserialize_long_long(&cp, &sf.seq);
|
||||
}
|
||||
deserialize_long_long(&cp, &sf.seq);
|
||||
|
||||
sf.tippecanoe_minzoom = -1;
|
||||
sf.tippecanoe_maxzoom = -1;
|
||||
@@ -683,10 +677,6 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf) {
|
||||
*(sst->area_sum) += extent;
|
||||
}
|
||||
|
||||
if (!prevent[P_INPUT_ORDER]) {
|
||||
sf.seq = 0;
|
||||
}
|
||||
|
||||
unsigned long long bbox_index;
|
||||
long long midx, midy;
|
||||
|
||||
@@ -837,12 +827,8 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf) {
|
||||
|
||||
if (!sst->filters) {
|
||||
for (size_t i = 0; i < sf.full_keys.size(); i++) {
|
||||
type_and_string attrib;
|
||||
attrib.type = sf.full_values[i].type;
|
||||
attrib.string = sf.full_values[i].s;
|
||||
|
||||
auto fk = sst->layermap->find(sf.layername);
|
||||
add_to_file_keys(fk->second.file_keys, sf.full_keys[i], attrib);
|
||||
auto ts = sst->layermap->find(sf.layername);
|
||||
add_to_tilestats(ts->second.tilestats, sf.full_keys[i], sf.full_values[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,9 +31,16 @@ void deserialize_ulong_long(char **f, unsigned long long *n);
|
||||
void deserialize_uint(char **f, unsigned *n);
|
||||
void deserialize_byte(char **f, signed char *n);
|
||||
|
||||
// This is the main representation of attribute values in memory and
|
||||
// in the string pool. The type is one of the mvt_value type (mvt_string,
|
||||
// mvt_double, mvt_bool, or mvt_null). Note that all numeric values,
|
||||
// whether integer or floating point, use mvt_double here.
|
||||
struct serial_val {
|
||||
int type = 0;
|
||||
std::string s = "";
|
||||
|
||||
bool operator<(const serial_val &o) const;
|
||||
bool operator!=(const serial_val &o) const;
|
||||
};
|
||||
|
||||
struct serial_feature {
|
||||
|
||||
+1
@@ -10,6 +10,7 @@
|
||||
"minzoom": "0",
|
||||
"name": "tests/accumulate/out/-z3_-Ethesum%3asum_-Etheproduct%3aproduct_-Ethemax%3amax_-Ethemin%3amin_-Ethemean%3amean_-Etheconcat%3aconcat_-Ethecomma%3acomma_-r1_-K100.json.check.mbtiles",
|
||||
"strategies": "[{\"coalesced_as_needed\":78},{\"coalesced_as_needed\":65},{\"coalesced_as_needed\":43},{\"coalesced_as_needed\":17}]",
|
||||
"tippecanoe_decisions": "{\"basezoom\":3,\"droprate\":1,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"maxzoom": "0",
|
||||
"minzoom": "0",
|
||||
"name": "tests/layer-json/out.mbtiles",
|
||||
"tippecanoe_decisions": "{\"basezoom\":0,\"droprate\":1,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
"minzoom": "11",
|
||||
"name": "tests/muni/out/-Z11_-z13_-B15.json.check.mbtiles",
|
||||
"strategies": "[{},{},{},{},{},{},{},{},{},{},{},{\"dropped_by_rate\":4727},{\"dropped_by_rate\":4643},{\"dropped_by_rate\":4210}]",
|
||||
"tippecanoe_decisions": "{\"basezoom\":15,\"droprate\":2.5,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
"minzoom": "11",
|
||||
"name": "tests/muni/out/-Z11_-z13_-Bf2000.json.check.mbtiles",
|
||||
"strategies": "[{},{},{},{},{},{},{},{},{},{},{},{\"dropped_by_rate\":2910},{},{}]",
|
||||
"tippecanoe_decisions": "{\"basezoom\":12,\"droprate\":2.5,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
"minzoom": "11",
|
||||
"name": "tests/muni/out/-Z11_-z13_-rf2000.json.check.mbtiles",
|
||||
"strategies": "[{},{},{},{},{},{},{},{},{},{},{},{\"dropped_by_rate\":2542},{\"dropped_by_rate\":1547},{}]",
|
||||
"tippecanoe_decisions": "{\"basezoom\":13,\"droprate\":1.4510341140028376,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
"minzoom": "11",
|
||||
"name": "tests/muni/out/-Z11_-z13_-rf2000_-Bg.json.check.mbtiles",
|
||||
"strategies": "[{},{},{},{},{},{},{},{},{},{},{},{\"dropped_by_rate\":2546},{},{}]",
|
||||
"tippecanoe_decisions": "{\"basezoom\":12,\"droprate\":2.1055,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
"minzoom": "11",
|
||||
"name": "tests/muni/out/-Z11_-z13_-rf2000_-g2.json.check.mbtiles",
|
||||
"strategies": "[{},{},{},{},{},{},{},{},{},{},{},{\"dropped_by_rate\":1349,\"dropped_by_gamma\":963},{\"dropped_by_rate\":747,\"dropped_by_gamma\":752},{\"dropped_by_gamma\":514}]",
|
||||
"tippecanoe_decisions": "{\"basezoom\":13,\"droprate\":1.176222768016331,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
"minzoom": "0",
|
||||
"name": "tests/muni/out/-r1_-K20.json.check.mbtiles",
|
||||
"strategies": "[{\"coalesced_as_needed\":4608},{\"coalesced_as_needed\":4608},{\"coalesced_as_needed\":4608},{\"coalesced_as_needed\":4608},{\"coalesced_as_needed\":4608},{\"coalesced_as_needed\":4607},{\"coalesced_as_needed\":4607},{\"coalesced_as_needed\":4606},{\"coalesced_as_needed\":6005},{\"coalesced_as_needed\":5393},{\"coalesced_as_needed\":5012},{\"coalesced_as_needed\":4727},{\"coalesced_as_needed\":4577},{\"coalesced_as_needed\":4003},{\"coalesced_as_needed\":3005}]",
|
||||
"tippecanoe_decisions": "{\"basezoom\":14,\"droprate\":1,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
+23842
File diff suppressed because it is too large
Load Diff
+34708
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+308
File diff suppressed because one or more lines are too long
@@ -10,6 +10,7 @@
|
||||
"minzoom": "0",
|
||||
"name": "tests/ne_110m_admin_0_countries/out/-ae_-zg_-M5000_--drop-densest-as-needed.json.check.mbtiles",
|
||||
"strategies": "[{\"dropped_as_needed\":167,\"tile_size_desired\":39241},{\"dropped_as_needed\":184,\"tile_size_desired\":25163},{\"dropped_as_needed\":160,\"tiny_polygons\":1,\"tile_size_desired\":21214},{\"dropped_as_needed\":133,\"tile_size_desired\":10758},{\"dropped_as_needed\":58,\"tile_size_desired\":6601},{\"tiny_polygons\":2}]",
|
||||
"tippecanoe_decisions": "{\"basezoom\":0,\"droprate\":2.5,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
"minzoom": "0",
|
||||
"name": "tests/ne_110m_admin_0_countries/out/-ae_-zg_-M5000_--drop-fraction-as-needed.json.check.mbtiles",
|
||||
"strategies": "[{\"dropped_as_needed\":164,\"tile_size_desired\":39241},{\"dropped_as_needed\":187,\"tile_size_desired\":25163},{\"dropped_as_needed\":190,\"tiny_polygons\":1,\"tile_size_desired\":21214},{\"dropped_as_needed\":181,\"tile_size_desired\":10758},{\"dropped_as_needed\":147,\"tile_size_desired\":6601},{\"tiny_polygons\":2}]",
|
||||
"tippecanoe_decisions": "{\"basezoom\":0,\"droprate\":2.5,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
"minzoom": "0",
|
||||
"name": "tests/ne_110m_admin_0_countries/out/-ae_-zg_-M5000_--drop-smallest-as-needed.json.check.mbtiles",
|
||||
"strategies": "[{\"dropped_as_needed\":174,\"tile_size_desired\":39241},{\"dropped_as_needed\":200,\"tile_size_desired\":25163},{\"dropped_as_needed\":187,\"tiny_polygons\":1,\"tile_size_desired\":21214},{\"dropped_as_needed\":154,\"tile_size_desired\":10758},{\"dropped_as_needed\":79,\"tile_size_desired\":6601},{\"tiny_polygons\":2}]",
|
||||
"tippecanoe_decisions": "{\"basezoom\":0,\"droprate\":2.5,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
"minzoom": "0",
|
||||
"name": "tests/ne_110m_admin_0_countries/out/-ae_-zg_-M5000_--force-feature-limit.json.check.mbtiles",
|
||||
"strategies": "[{\"dropped_as_needed\":479,\"tile_size_desired\":39241},{\"dropped_as_needed\":264,\"tiny_polygons\":2,\"tile_size_desired\":25163},{\"dropped_as_needed\":221,\"tiny_polygons\":2,\"tile_size_desired\":21214},{\"dropped_as_needed\":93,\"tile_size_desired\":10758},{\"dropped_as_needed\":9,\"tile_size_desired\":6601},{\"tiny_polygons\":2}]",
|
||||
"tippecanoe_decisions": "{\"basezoom\":0,\"droprate\":2.5,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
+1
@@ -10,6 +10,7 @@
|
||||
"minzoom": "0",
|
||||
"name": "tests/ne_110m_populated_places/out/--smallest-maximum-zoom-guess_2_-Bf20_-rf20_-pb.json.check.mbtiles",
|
||||
"strategies": "[{\"dropped_by_rate\":237},{\"dropped_by_rate\":229},{}]",
|
||||
"tippecanoe_decisions": "{\"basezoom\":2,\"droprate\":6.599999999999999,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"maxzoom": "3",
|
||||
"minzoom": "0",
|
||||
"name": "tests/ne_110m_populated_places/out/--smallest-maximum-zoom-guess_3_-Bg.json.check.mbtiles",
|
||||
"tippecanoe_decisions": "{\"basezoom\":0,\"droprate\":2.5,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
"minzoom": "0",
|
||||
"name": "tests/ne_110m_populated_places/out/--smallest-maximum-zoom-guess_3_-rp.json.check.mbtiles",
|
||||
"strategies": "[{\"dropped_by_rate\":230},{\"dropped_by_rate\":231},{\"dropped_by_rate\":160},{}]",
|
||||
"tippecanoe_decisions": "{\"basezoom\":3,\"droprate\":2.6582825467008166,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
+1
@@ -9,6 +9,7 @@
|
||||
"maxzoom": "8",
|
||||
"minzoom": "0",
|
||||
"name": "tests/ne_110m_populated_places/out/-r1_-z8_-J_tests%2ffeature-filter%2fplaces-filter.json.check.mbtiles",
|
||||
"tippecanoe_decisions": "{\"basezoom\":8,\"droprate\":1,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "NAME": "Vancouver" }, "geometry": { "type": "Point", "coordinates": [ -123.134766, 49.267805 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Denver" }, "geometry": { "type": "Point", "coordinates": [ -104.941406, 39.707187 ] } }
|
||||
{ "type": "Feature", "properties": { "NAME": "San Francisco" }, "geometry": { "type": "Point", "coordinates": [ -122.431641, 37.788081 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Chicago" }, "geometry": { "type": "Point", "coordinates": [ -87.714844, 41.836828 ] } }
|
||||
,
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
"minzoom": "0",
|
||||
"name": "tests/ne_110m_populated_places/out/-yNAME_-z5_-B3.json.check.mbtiles",
|
||||
"strategies": "[{\"dropped_by_rate\":227},{\"dropped_by_rate\":227},{\"dropped_by_rate\":152},{},{},{}]",
|
||||
"tippecanoe_decisions": "{\"basezoom\":3,\"droprate\":2.5,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
"minzoom": "0",
|
||||
"name": "tests/ne_110m_populated_places/out/-yNAME_-z5_-r1.5.json.check.mbtiles",
|
||||
"strategies": "[{\"dropped_by_rate\":211},{\"dropped_by_rate\":214},{\"dropped_by_rate\":179},{\"dropped_by_rate\":138},{\"dropped_by_rate\":70},{}]",
|
||||
"tippecanoe_decisions": "{\"basezoom\":5,\"droprate\":1.5,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
+1
@@ -10,6 +10,7 @@
|
||||
"minzoom": "0",
|
||||
"name": "tests/ne_110m_populated_places/out/-z0_-M10000_--drop-densest-as-needed_--extend-zooms-if-still-dropping-maximum_2.json.check.mbtiles",
|
||||
"strategies": "[{\"dropped_as_needed\":219,\"tile_size_desired\":74734},{\"dropped_as_needed\":207,\"tile_size_desired\":44415},{\"dropped_as_needed\":181,\"tile_size_desired\":35130}]",
|
||||
"tippecanoe_decisions": "{\"basezoom\":0,\"droprate\":2.5,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
+1
@@ -9,6 +9,7 @@
|
||||
"maxzoom": "0",
|
||||
"minzoom": "0",
|
||||
"name": "tests/ne_110m_populated_places/out/-z0_-r1_-yNAME_-ySOV0NAME_-yELEVATION_-YNAME%3aCity_-YSOV0NAME%3aCountry.json.check.mbtiles",
|
||||
"tippecanoe_decisions": "{\"basezoom\":0,\"droprate\":1,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
+206
@@ -0,0 +1,206 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "-175.220564,-41.299973,179.216647,64.150023",
|
||||
"bounds": "-175.220564,-41.299973,179.216647,64.150023",
|
||||
"center": "0.000000,0.000000,0",
|
||||
"description": "tests/ne_110m_populated_places/out/-z0_-r2_-B3_-yNAME_--retain-points-multiplier_3_--order-by_NAME.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/ne_110m_populated_places/out/-z0_-r2_-B3_-yNAME_--retain-points-multiplier_3_--order-by_NAME.json.check.mbtiles -z0 -r2 -B3 -yNAME --retain-points-multiplier 3 --order-by NAME tests/ne_110m_populated_places/in.json",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{\"NAME\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":243,\"geometry\":\"Point\",\"attributeCount\":1,\"attributes\":[{\"attribute\":\"NAME\",\"count\":243,\"type\":\"string\",\"values\":[\"Abidjan\",\"Abu Dhabi\",\"Abuja\",\"Accra\",\"Addis Ababa\",\"Algiers\",\"Amman\",\"Amsterdam\",\"Andorra\",\"Ankara\",\"Antananarivo\",\"Apia\",\"Ashgabat\",\"Asmara\",\"Astana\",\"Asuncion\",\"Athens\",\"Atlanta\",\"Auckland\",\"Baghdad\",\"Baguio City\",\"Baku\",\"Bamako\",\"Bandar Seri Begawan\",\"Bangalore\",\"Bangkok\",\"Bangui\",\"Banjul\",\"Basseterre\",\"Beijing\",\"Beirut\",\"Belgrade\",\"Belmopan\",\"Berlin\",\"Bern\",\"Bir Lehlou\",\"Bishkek\",\"Bissau\",\"Bloemfontein\",\"Bogota\",\"Brasilia\",\"Bratislava\",\"Brazzaville\",\"Bridgetown\",\"Brussels\",\"Bucharest\",\"Budapest\",\"Buenos Aires\",\"Bujumbura\",\"Cairo\",\"Canberra\",\"Cape Town\",\"Caracas\",\"Casablanca\",\"Castries\",\"Chengdu\",\"Chicago\",\"Chisinau\",\"Colombo\",\"Conakry\",\"Cotonou\",\"Dakar\",\"Damascus\",\"Dar es Salaam\",\"Denver\",\"Dhaka\",\"Dili\",\"Djibouti\",\"Dodoma\",\"Doha\",\"Dubai\",\"Dublin\",\"Dushanbe\",\"Freetown\",\"Funafuti\",\"Gaborone\",\"Geneva\",\"Georgetown\",\"Guatemala\",\"Hanoi\",\"Harare\",\"Hargeysa\",\"Havana\",\"Helsinki\",\"Hong Kong\",\"Honiara\",\"Houston\",\"Islamabad\",\"Istanbul\",\"Jakarta\",\"Jerusalem\",\"Johannesburg\",\"Juba\",\"Kabul\",\"Kampala\",\"Kathmandu\",\"Khartoum\",\"Kiev\",\"Kigali\",\"Kingston\"]}]}]}}",
|
||||
"maxzoom": "0",
|
||||
"minzoom": "0",
|
||||
"name": "tests/ne_110m_populated_places/out/-z0_-r2_-B3_-yNAME_--retain-points-multiplier_3_--order-by_NAME.json.check.mbtiles",
|
||||
"strategies": "[{\"dropped_by_rate\":150}]",
|
||||
"tippecanoe_decisions": "{\"basezoom\":3,\"droprate\":2,\"retain_points_multiplier\":3}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 0, "x": 0, "y": 0 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "NAME": "Astana", "tippecanoe:retain_points_multiplier_sequence": 41, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 71.455078, 51.179343 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Tashkent", "tippecanoe:retain_points_multiplier_sequence": 67 }, "geometry": { "type": "Point", "coordinates": [ 69.257812, 41.310824 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Bishkek", "tippecanoe:retain_points_multiplier_sequence": 29 }, "geometry": { "type": "Point", "coordinates": [ 74.619141, 42.875964 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Bangkok", "tippecanoe:retain_points_multiplier_sequence": 68, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 100.546875, 13.752725 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Vientiane", "tippecanoe:retain_points_multiplier_sequence": 42 }, "geometry": { "type": "Point", "coordinates": [ 102.568359, 17.978733 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Hanoi", "tippecanoe:retain_points_multiplier_sequence": 51 }, "geometry": { "type": "Point", "coordinates": [ 105.820312, 21.043491 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Berlin", "tippecanoe:retain_points_multiplier_sequence": 72, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 13.359375, 52.536273 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Prague", "tippecanoe:retain_points_multiplier_sequence": 59 }, "geometry": { "type": "Point", "coordinates": [ 14.501953, 50.064192 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Warsaw", "tippecanoe:retain_points_multiplier_sequence": 55 }, "geometry": { "type": "Point", "coordinates": [ 21.005859, 52.268157 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Bir Lehlou", "tippecanoe:retain_points_multiplier_sequence": 3, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ -9.667969, 26.115986 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Dakar", "tippecanoe:retain_points_multiplier_sequence": 70 }, "geometry": { "type": "Point", "coordinates": [ -17.490234, 14.689881 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Nouakchott", "tippecanoe:retain_points_multiplier_sequence": 39 }, "geometry": { "type": "Point", "coordinates": [ -15.996094, 18.062312 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Bucharest", "tippecanoe:retain_points_multiplier_sequence": 53, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 26.103516, 44.465151 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Chisinau", "tippecanoe:retain_points_multiplier_sequence": 26 }, "geometry": { "type": "Point", "coordinates": [ 28.828125, 46.980252 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Istanbul", "tippecanoe:retain_points_multiplier_sequence": 83 }, "geometry": { "type": "Point", "coordinates": [ 29.003906, 41.112469 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Cairo", "tippecanoe:retain_points_multiplier_sequence": 87, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 31.289062, 30.069094 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Tel Aviv-Yafo", "tippecanoe:retain_points_multiplier_sequence": 61 }, "geometry": { "type": "Point", "coordinates": [ 34.804688, 32.101190 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Beirut", "tippecanoe:retain_points_multiplier_sequence": 40 }, "geometry": { "type": "Point", "coordinates": [ 35.507812, 33.870416 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Dublin", "tippecanoe:retain_points_multiplier_sequence": 57, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ -6.240234, 53.330873 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "London", "tippecanoe:retain_points_multiplier_sequence": 82 }, "geometry": { "type": "Point", "coordinates": [ -0.087891, 51.508742 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Praia", "tippecanoe:retain_points_multiplier_sequence": 49 }, "geometry": { "type": "Point", "coordinates": [ -23.554688, 14.944785 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Funafuti", "tippecanoe:retain_points_multiplier_sequence": 1, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "MultiPoint", "coordinates": [ [ 179.208984, -8.494105 ], [ -180.791016, -8.494105 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Suva", "tippecanoe:retain_points_multiplier_sequence": 37 }, "geometry": { "type": "MultiPoint", "coordinates": [ [ 178.417969, -18.145852 ], [ -181.582031, -18.145852 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Auckland", "tippecanoe:retain_points_multiplier_sequence": 71 }, "geometry": { "type": "MultiPoint", "coordinates": [ [ 174.726562, -36.879621 ], [ -185.273438, -36.879621 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Guatemala", "tippecanoe:retain_points_multiplier_sequence": 35, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ -90.527344, 14.604847 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Chicago", "tippecanoe:retain_points_multiplier_sequence": 65 }, "geometry": { "type": "Point", "coordinates": [ -87.714844, 41.836828 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Toronto", "tippecanoe:retain_points_multiplier_sequence": 77 }, "geometry": { "type": "Point", "coordinates": [ -79.453125, 43.707594 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Hong Kong", "tippecanoe:retain_points_multiplier_sequence": 92, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 114.169922, 22.268764 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Shanghai", "tippecanoe:retain_points_multiplier_sequence": 88 }, "geometry": { "type": "Point", "coordinates": [ 121.464844, 31.203405 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Taipei", "tippecanoe:retain_points_multiplier_sequence": 79 }, "geometry": { "type": "Point", "coordinates": [ 121.552734, 25.005973 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Jakarta", "tippecanoe:retain_points_multiplier_sequence": 86, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 106.787109, -6.140555 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Dili", "tippecanoe:retain_points_multiplier_sequence": 19 }, "geometry": { "type": "Point", "coordinates": [ 125.595703, -8.581021 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Port Moresby", "tippecanoe:retain_points_multiplier_sequence": 25 }, "geometry": { "type": "Point", "coordinates": [ 147.216797, -9.449062 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Kabul", "tippecanoe:retain_points_multiplier_sequence": 78, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 69.169922, 34.524661 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Islamabad", "tippecanoe:retain_points_multiplier_sequence": 23 }, "geometry": { "type": "Point", "coordinates": [ 73.125000, 33.724340 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "New Delhi", "tippecanoe:retain_points_multiplier_sequence": 75 }, "geometry": { "type": "Point", "coordinates": [ 77.167969, 28.613459 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Khartoum", "tippecanoe:retain_points_multiplier_sequence": 54, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 32.519531, 15.623037 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Juba", "tippecanoe:retain_points_multiplier_sequence": 6 }, "geometry": { "type": "Point", "coordinates": [ 31.552734, 4.828260 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Kampala", "tippecanoe:retain_points_multiplier_sequence": 21 }, "geometry": { "type": "Point", "coordinates": [ 32.607422, 0.351560 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Kingston", "tippecanoe:retain_points_multiplier_sequence": 31, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ -76.728516, 17.978733 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Port-au-Prince", "tippecanoe:retain_points_multiplier_sequence": 20 }, "geometry": { "type": "Point", "coordinates": [ -72.333984, 18.562947 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Santo Domingo", "tippecanoe:retain_points_multiplier_sequence": 60 }, "geometry": { "type": "Point", "coordinates": [ -69.873047, 18.479609 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Kingstown", "tippecanoe:retain_points_multiplier_sequence": 14, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ -61.171875, 13.154376 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Saint George's", "tippecanoe:retain_points_multiplier_sequence": 15 }, "geometry": { "type": "Point", "coordinates": [ -61.699219, 12.039321 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Bridgetown", "tippecanoe:retain_points_multiplier_sequence": 13 }, "geometry": { "type": "Point", "coordinates": [ -59.589844, 13.068777 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Kinshasa", "tippecanoe:retain_points_multiplier_sequence": 74, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 15.292969, -4.302591 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Luanda", "tippecanoe:retain_points_multiplier_sequence": 63 }, "geometry": { "type": "Point", "coordinates": [ 13.271484, -8.841651 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Windhoek", "tippecanoe:retain_points_multiplier_sequence": 28 }, "geometry": { "type": "Point", "coordinates": [ 17.050781, -22.593726 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Lima", "tippecanoe:retain_points_multiplier_sequence": 69, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ -77.080078, -12.039321 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "La Paz", "tippecanoe:retain_points_multiplier_sequence": 45 }, "geometry": { "type": "Point", "coordinates": [ -68.115234, -16.467695 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Valparaiso", "tippecanoe:retain_points_multiplier_sequence": 38 }, "geometry": { "type": "Point", "coordinates": [ -71.630859, -33.063924 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Luxembourg", "tippecanoe:retain_points_multiplier_sequence": 0, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 6.152344, 49.610710 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Paris", "tippecanoe:retain_points_multiplier_sequence": 89 }, "geometry": { "type": "Point", "coordinates": [ 2.373047, 48.864715 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Andorra", "tippecanoe:retain_points_multiplier_sequence": 4 }, "geometry": { "type": "Point", "coordinates": [ 1.494141, 42.488302 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Malabo", "tippecanoe:retain_points_multiplier_sequence": 33, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 8.789062, 3.776559 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Libreville", "tippecanoe:retain_points_multiplier_sequence": 36 }, "geometry": { "type": "Point", "coordinates": [ 9.492188, 0.351560 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Ndjamena", "tippecanoe:retain_points_multiplier_sequence": 32 }, "geometry": { "type": "Point", "coordinates": [ 15.029297, 12.125264 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Male", "tippecanoe:retain_points_multiplier_sequence": 48, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 73.476562, 4.127285 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Colombo", "tippecanoe:retain_points_multiplier_sequence": 27 }, "geometry": { "type": "Point", "coordinates": [ 79.892578, 6.926427 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Sri Jawewardenepura Kotte", "tippecanoe:retain_points_multiplier_sequence": 9 }, "geometry": { "type": "Point", "coordinates": [ 79.980469, 6.926427 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Manama", "tippecanoe:retain_points_multiplier_sequence": 16, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 50.625000, 26.273714 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Doha", "tippecanoe:retain_points_multiplier_sequence": 8 }, "geometry": { "type": "Point", "coordinates": [ 51.503906, 25.324167 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Dubai", "tippecanoe:retain_points_multiplier_sequence": 66 }, "geometry": { "type": "Point", "coordinates": [ 55.283203, 25.244696 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Maseru", "tippecanoe:retain_points_multiplier_sequence": 30, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 27.509766, -29.305561 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Pretoria", "tippecanoe:retain_points_multiplier_sequence": 24 }, "geometry": { "type": "Point", "coordinates": [ 28.212891, -25.720735 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Mbabane", "tippecanoe:retain_points_multiplier_sequence": 5 }, "geometry": { "type": "Point", "coordinates": [ 31.113281, -26.352498 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Melekeok", "tippecanoe:retain_points_multiplier_sequence": 2, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 134.648438, 7.449624 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Osaka", "tippecanoe:retain_points_multiplier_sequence": 73 }, "geometry": { "type": "Point", "coordinates": [ 135.439453, 34.741612 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Kyoto", "tippecanoe:retain_points_multiplier_sequence": 11 }, "geometry": { "type": "Point", "coordinates": [ 135.791016, 35.029996 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Nairobi", "tippecanoe:retain_points_multiplier_sequence": 85, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 36.826172, -1.318243 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Dodoma", "tippecanoe:retain_points_multiplier_sequence": 10 }, "geometry": { "type": "Point", "coordinates": [ 35.771484, -6.140555 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Dar es Salaam", "tippecanoe:retain_points_multiplier_sequence": 56 }, "geometry": { "type": "Point", "coordinates": [ 39.287109, -6.839170 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "New York", "tippecanoe:retain_points_multiplier_sequence": 81, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ -74.003906, 40.780541 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Nassau", "tippecanoe:retain_points_multiplier_sequence": 50 }, "geometry": { "type": "Point", "coordinates": [ -77.343750, 25.085599 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Belmopan", "tippecanoe:retain_points_multiplier_sequence": 44 }, "geometry": { "type": "Point", "coordinates": [ -88.769531, 17.224758 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Ouagadougou", "tippecanoe:retain_points_multiplier_sequence": 46, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ -1.494141, 12.382928 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Monrovia", "tippecanoe:retain_points_multiplier_sequence": 58 }, "geometry": { "type": "Point", "coordinates": [ -10.810547, 6.315299 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Yamoussoukro", "tippecanoe:retain_points_multiplier_sequence": 43 }, "geometry": { "type": "Point", "coordinates": [ -5.273438, 6.839170 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Rome", "tippecanoe:retain_points_multiplier_sequence": 84, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 12.480469, 41.902277 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Bratislava", "tippecanoe:retain_points_multiplier_sequence": 7 }, "geometry": { "type": "Point", "coordinates": [ 17.138672, 48.166085 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Budapest", "tippecanoe:retain_points_multiplier_sequence": 52 }, "geometry": { "type": "Point", "coordinates": [ 19.072266, 47.517201 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Sao Paulo", "tippecanoe:retain_points_multiplier_sequence": 91, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ -46.669922, -23.563987 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Montevideo", "tippecanoe:retain_points_multiplier_sequence": 17 }, "geometry": { "type": "Point", "coordinates": [ -56.162109, -34.885931 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Rio de Janeiro", "tippecanoe:retain_points_multiplier_sequence": 90 }, "geometry": { "type": "Point", "coordinates": [ -43.242188, -22.917923 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Skopje", "tippecanoe:retain_points_multiplier_sequence": 12, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 21.445312, 41.967659 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Helsinki", "tippecanoe:retain_points_multiplier_sequence": 62 }, "geometry": { "type": "Point", "coordinates": [ 24.960938, 60.196156 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Tallinn", "tippecanoe:retain_points_multiplier_sequence": 34 }, "geometry": { "type": "Point", "coordinates": [ 24.697266, 59.445075 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Valletta", "tippecanoe:retain_points_multiplier_sequence": 47, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 14.501953, 35.889050 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Niamey", "tippecanoe:retain_points_multiplier_sequence": 22 }, "geometry": { "type": "Point", "coordinates": [ 2.109375, 13.496473 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Lome", "tippecanoe:retain_points_multiplier_sequence": 18 }, "geometry": { "type": "Point", "coordinates": [ 1.230469, 6.140555 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Vancouver", "tippecanoe:retain_points_multiplier_sequence": 76, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ -123.134766, 49.267805 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "San Francisco", "tippecanoe:retain_points_multiplier_sequence": 64 }, "geometry": { "type": "Point", "coordinates": [ -122.431641, 37.788081 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Los Angeles", "tippecanoe:retain_points_multiplier_sequence": 80 }, "geometry": { "type": "Point", "coordinates": [ -118.212891, 34.016242 ] } }
|
||||
] }
|
||||
] }
|
||||
] }
|
||||
+206
@@ -0,0 +1,206 @@
|
||||
{ "type": "FeatureCollection", "properties": {
|
||||
"antimeridian_adjusted_bounds": "-175.220564,-41.299973,179.216647,64.150023",
|
||||
"bounds": "-175.220564,-41.299973,179.216647,64.150023",
|
||||
"center": "0.000000,0.000000,0",
|
||||
"description": "tests/ne_110m_populated_places/out/-z0_-r2_-B3_-yNAME_--retain-points-multiplier_3_--preserve-input-order.json.check.mbtiles",
|
||||
"format": "pbf",
|
||||
"generator_options": "./tippecanoe -q -a@ -f -o tests/ne_110m_populated_places/out/-z0_-r2_-B3_-yNAME_--retain-points-multiplier_3_--preserve-input-order.json.check.mbtiles -z0 -r2 -B3 -yNAME --retain-points-multiplier 3 --preserve-input-order tests/ne_110m_populated_places/in.json",
|
||||
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{\"NAME\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":243,\"geometry\":\"Point\",\"attributeCount\":1,\"attributes\":[{\"attribute\":\"NAME\",\"count\":243,\"type\":\"string\",\"values\":[\"Abidjan\",\"Abu Dhabi\",\"Abuja\",\"Accra\",\"Addis Ababa\",\"Algiers\",\"Amman\",\"Amsterdam\",\"Andorra\",\"Ankara\",\"Antananarivo\",\"Apia\",\"Ashgabat\",\"Asmara\",\"Astana\",\"Asuncion\",\"Athens\",\"Atlanta\",\"Auckland\",\"Baghdad\",\"Baguio City\",\"Baku\",\"Bamako\",\"Bandar Seri Begawan\",\"Bangalore\",\"Bangkok\",\"Bangui\",\"Banjul\",\"Basseterre\",\"Beijing\",\"Beirut\",\"Belgrade\",\"Belmopan\",\"Berlin\",\"Bern\",\"Bir Lehlou\",\"Bishkek\",\"Bissau\",\"Bloemfontein\",\"Bogota\",\"Brasilia\",\"Bratislava\",\"Brazzaville\",\"Bridgetown\",\"Brussels\",\"Bucharest\",\"Budapest\",\"Buenos Aires\",\"Bujumbura\",\"Cairo\",\"Canberra\",\"Cape Town\",\"Caracas\",\"Casablanca\",\"Castries\",\"Chengdu\",\"Chicago\",\"Chisinau\",\"Colombo\",\"Conakry\",\"Cotonou\",\"Dakar\",\"Damascus\",\"Dar es Salaam\",\"Denver\",\"Dhaka\",\"Dili\",\"Djibouti\",\"Dodoma\",\"Doha\",\"Dubai\",\"Dublin\",\"Dushanbe\",\"Freetown\",\"Funafuti\",\"Gaborone\",\"Geneva\",\"Georgetown\",\"Guatemala\",\"Hanoi\",\"Harare\",\"Hargeysa\",\"Havana\",\"Helsinki\",\"Hong Kong\",\"Honiara\",\"Houston\",\"Islamabad\",\"Istanbul\",\"Jakarta\",\"Jerusalem\",\"Johannesburg\",\"Juba\",\"Kabul\",\"Kampala\",\"Kathmandu\",\"Khartoum\",\"Kiev\",\"Kigali\",\"Kingston\"]}]}]}}",
|
||||
"maxzoom": "0",
|
||||
"minzoom": "0",
|
||||
"name": "tests/ne_110m_populated_places/out/-z0_-r2_-B3_-yNAME_--retain-points-multiplier_3_--preserve-input-order.json.check.mbtiles",
|
||||
"strategies": "[{\"dropped_by_rate\":150}]",
|
||||
"tippecanoe_decisions": "{\"basezoom\":3,\"droprate\":2,\"retain_points_multiplier\":3}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 0, "x": 0, "y": 0 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "NAME": "Luxembourg", "tippecanoe:retain_points_multiplier_sequence": 0, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 6.152344, 49.610710 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Paris", "tippecanoe:retain_points_multiplier_sequence": 89 }, "geometry": { "type": "Point", "coordinates": [ 2.373047, 48.864715 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Andorra", "tippecanoe:retain_points_multiplier_sequence": 4 }, "geometry": { "type": "Point", "coordinates": [ 1.494141, 42.488302 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Funafuti", "tippecanoe:retain_points_multiplier_sequence": 1, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "MultiPoint", "coordinates": [ [ 179.208984, -8.494105 ], [ -180.791016, -8.494105 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Suva", "tippecanoe:retain_points_multiplier_sequence": 37 }, "geometry": { "type": "MultiPoint", "coordinates": [ [ 178.417969, -18.145852 ], [ -181.582031, -18.145852 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Auckland", "tippecanoe:retain_points_multiplier_sequence": 71 }, "geometry": { "type": "MultiPoint", "coordinates": [ [ 174.726562, -36.879621 ], [ -185.273438, -36.879621 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Melekeok", "tippecanoe:retain_points_multiplier_sequence": 2, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 134.648438, 7.449624 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Osaka", "tippecanoe:retain_points_multiplier_sequence": 73 }, "geometry": { "type": "Point", "coordinates": [ 135.439453, 34.741612 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Kyoto", "tippecanoe:retain_points_multiplier_sequence": 11 }, "geometry": { "type": "Point", "coordinates": [ 135.791016, 35.029996 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Bir Lehlou", "tippecanoe:retain_points_multiplier_sequence": 3, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ -9.667969, 26.115986 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Dakar", "tippecanoe:retain_points_multiplier_sequence": 70 }, "geometry": { "type": "Point", "coordinates": [ -17.490234, 14.689881 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Nouakchott", "tippecanoe:retain_points_multiplier_sequence": 39 }, "geometry": { "type": "Point", "coordinates": [ -15.996094, 18.062312 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Skopje", "tippecanoe:retain_points_multiplier_sequence": 12, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 21.445312, 41.967659 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Helsinki", "tippecanoe:retain_points_multiplier_sequence": 62 }, "geometry": { "type": "Point", "coordinates": [ 24.960938, 60.196156 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Tallinn", "tippecanoe:retain_points_multiplier_sequence": 34 }, "geometry": { "type": "Point", "coordinates": [ 24.697266, 59.445075 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Kingstown", "tippecanoe:retain_points_multiplier_sequence": 14, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ -61.171875, 13.154376 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Saint George's", "tippecanoe:retain_points_multiplier_sequence": 15 }, "geometry": { "type": "Point", "coordinates": [ -61.699219, 12.039321 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Bridgetown", "tippecanoe:retain_points_multiplier_sequence": 13 }, "geometry": { "type": "Point", "coordinates": [ -59.589844, 13.068777 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Manama", "tippecanoe:retain_points_multiplier_sequence": 16, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 50.625000, 26.273714 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Doha", "tippecanoe:retain_points_multiplier_sequence": 8 }, "geometry": { "type": "Point", "coordinates": [ 51.503906, 25.324167 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Dubai", "tippecanoe:retain_points_multiplier_sequence": 66 }, "geometry": { "type": "Point", "coordinates": [ 55.283203, 25.244696 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Maseru", "tippecanoe:retain_points_multiplier_sequence": 30, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 27.509766, -29.305561 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Pretoria", "tippecanoe:retain_points_multiplier_sequence": 24 }, "geometry": { "type": "Point", "coordinates": [ 28.212891, -25.720735 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Mbabane", "tippecanoe:retain_points_multiplier_sequence": 5 }, "geometry": { "type": "Point", "coordinates": [ 31.113281, -26.352498 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Kingston", "tippecanoe:retain_points_multiplier_sequence": 31, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ -76.728516, 17.978733 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Port-au-Prince", "tippecanoe:retain_points_multiplier_sequence": 20 }, "geometry": { "type": "Point", "coordinates": [ -72.333984, 18.562947 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Santo Domingo", "tippecanoe:retain_points_multiplier_sequence": 60 }, "geometry": { "type": "Point", "coordinates": [ -69.873047, 18.479609 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Malabo", "tippecanoe:retain_points_multiplier_sequence": 33, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 8.789062, 3.776559 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Libreville", "tippecanoe:retain_points_multiplier_sequence": 36 }, "geometry": { "type": "Point", "coordinates": [ 9.492188, 0.351560 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Ndjamena", "tippecanoe:retain_points_multiplier_sequence": 32 }, "geometry": { "type": "Point", "coordinates": [ 15.029297, 12.125264 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Guatemala", "tippecanoe:retain_points_multiplier_sequence": 35, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ -90.527344, 14.604847 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Chicago", "tippecanoe:retain_points_multiplier_sequence": 65 }, "geometry": { "type": "Point", "coordinates": [ -87.714844, 41.836828 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Toronto", "tippecanoe:retain_points_multiplier_sequence": 77 }, "geometry": { "type": "Point", "coordinates": [ -79.453125, 43.707594 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Astana", "tippecanoe:retain_points_multiplier_sequence": 41, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 71.455078, 51.179343 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Tashkent", "tippecanoe:retain_points_multiplier_sequence": 67 }, "geometry": { "type": "Point", "coordinates": [ 69.257812, 41.310824 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Bishkek", "tippecanoe:retain_points_multiplier_sequence": 29 }, "geometry": { "type": "Point", "coordinates": [ 74.619141, 42.875964 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Ouagadougou", "tippecanoe:retain_points_multiplier_sequence": 46, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ -1.494141, 12.382928 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Monrovia", "tippecanoe:retain_points_multiplier_sequence": 58 }, "geometry": { "type": "Point", "coordinates": [ -10.810547, 6.315299 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Yamoussoukro", "tippecanoe:retain_points_multiplier_sequence": 43 }, "geometry": { "type": "Point", "coordinates": [ -5.273438, 6.839170 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Valletta", "tippecanoe:retain_points_multiplier_sequence": 47, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 14.501953, 35.889050 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Niamey", "tippecanoe:retain_points_multiplier_sequence": 22 }, "geometry": { "type": "Point", "coordinates": [ 2.109375, 13.496473 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Lome", "tippecanoe:retain_points_multiplier_sequence": 18 }, "geometry": { "type": "Point", "coordinates": [ 1.230469, 6.140555 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Male", "tippecanoe:retain_points_multiplier_sequence": 48, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 73.476562, 4.127285 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Colombo", "tippecanoe:retain_points_multiplier_sequence": 27 }, "geometry": { "type": "Point", "coordinates": [ 79.892578, 6.926427 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Sri Jawewardenepura Kotte", "tippecanoe:retain_points_multiplier_sequence": 9 }, "geometry": { "type": "Point", "coordinates": [ 79.980469, 6.926427 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Bucharest", "tippecanoe:retain_points_multiplier_sequence": 53, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 26.103516, 44.465151 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Chisinau", "tippecanoe:retain_points_multiplier_sequence": 26 }, "geometry": { "type": "Point", "coordinates": [ 28.828125, 46.980252 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Istanbul", "tippecanoe:retain_points_multiplier_sequence": 83 }, "geometry": { "type": "Point", "coordinates": [ 29.003906, 41.112469 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Khartoum", "tippecanoe:retain_points_multiplier_sequence": 54, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 32.519531, 15.623037 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Juba", "tippecanoe:retain_points_multiplier_sequence": 6 }, "geometry": { "type": "Point", "coordinates": [ 31.552734, 4.828260 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Kampala", "tippecanoe:retain_points_multiplier_sequence": 21 }, "geometry": { "type": "Point", "coordinates": [ 32.607422, 0.351560 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Dublin", "tippecanoe:retain_points_multiplier_sequence": 57, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ -6.240234, 53.330873 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "London", "tippecanoe:retain_points_multiplier_sequence": 82 }, "geometry": { "type": "Point", "coordinates": [ -0.087891, 51.508742 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Praia", "tippecanoe:retain_points_multiplier_sequence": 49 }, "geometry": { "type": "Point", "coordinates": [ -23.554688, 14.944785 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Bangkok", "tippecanoe:retain_points_multiplier_sequence": 68, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 100.546875, 13.752725 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Vientiane", "tippecanoe:retain_points_multiplier_sequence": 42 }, "geometry": { "type": "Point", "coordinates": [ 102.568359, 17.978733 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Hanoi", "tippecanoe:retain_points_multiplier_sequence": 51 }, "geometry": { "type": "Point", "coordinates": [ 105.820312, 21.043491 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Lima", "tippecanoe:retain_points_multiplier_sequence": 69, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ -77.080078, -12.039321 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "La Paz", "tippecanoe:retain_points_multiplier_sequence": 45 }, "geometry": { "type": "Point", "coordinates": [ -68.115234, -16.467695 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Valparaiso", "tippecanoe:retain_points_multiplier_sequence": 38 }, "geometry": { "type": "Point", "coordinates": [ -71.630859, -33.063924 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Berlin", "tippecanoe:retain_points_multiplier_sequence": 72, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 13.359375, 52.536273 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Prague", "tippecanoe:retain_points_multiplier_sequence": 59 }, "geometry": { "type": "Point", "coordinates": [ 14.501953, 50.064192 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Warsaw", "tippecanoe:retain_points_multiplier_sequence": 55 }, "geometry": { "type": "Point", "coordinates": [ 21.005859, 52.268157 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Kinshasa", "tippecanoe:retain_points_multiplier_sequence": 74, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 15.292969, -4.302591 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Luanda", "tippecanoe:retain_points_multiplier_sequence": 63 }, "geometry": { "type": "Point", "coordinates": [ 13.271484, -8.841651 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Windhoek", "tippecanoe:retain_points_multiplier_sequence": 28 }, "geometry": { "type": "Point", "coordinates": [ 17.050781, -22.593726 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Vancouver", "tippecanoe:retain_points_multiplier_sequence": 76, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ -123.134766, 49.267805 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "San Francisco", "tippecanoe:retain_points_multiplier_sequence": 64 }, "geometry": { "type": "Point", "coordinates": [ -122.431641, 37.788081 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Los Angeles", "tippecanoe:retain_points_multiplier_sequence": 80 }, "geometry": { "type": "Point", "coordinates": [ -118.212891, 34.016242 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Kabul", "tippecanoe:retain_points_multiplier_sequence": 78, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 69.169922, 34.524661 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Islamabad", "tippecanoe:retain_points_multiplier_sequence": 23 }, "geometry": { "type": "Point", "coordinates": [ 73.125000, 33.724340 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "New Delhi", "tippecanoe:retain_points_multiplier_sequence": 75 }, "geometry": { "type": "Point", "coordinates": [ 77.167969, 28.613459 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "New York", "tippecanoe:retain_points_multiplier_sequence": 81, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ -74.003906, 40.780541 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Nassau", "tippecanoe:retain_points_multiplier_sequence": 50 }, "geometry": { "type": "Point", "coordinates": [ -77.343750, 25.085599 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Belmopan", "tippecanoe:retain_points_multiplier_sequence": 44 }, "geometry": { "type": "Point", "coordinates": [ -88.769531, 17.224758 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Rome", "tippecanoe:retain_points_multiplier_sequence": 84, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 12.480469, 41.902277 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Bratislava", "tippecanoe:retain_points_multiplier_sequence": 7 }, "geometry": { "type": "Point", "coordinates": [ 17.138672, 48.166085 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Budapest", "tippecanoe:retain_points_multiplier_sequence": 52 }, "geometry": { "type": "Point", "coordinates": [ 19.072266, 47.517201 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Nairobi", "tippecanoe:retain_points_multiplier_sequence": 85, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 36.826172, -1.318243 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Dodoma", "tippecanoe:retain_points_multiplier_sequence": 10 }, "geometry": { "type": "Point", "coordinates": [ 35.771484, -6.140555 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Dar es Salaam", "tippecanoe:retain_points_multiplier_sequence": 56 }, "geometry": { "type": "Point", "coordinates": [ 39.287109, -6.839170 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Jakarta", "tippecanoe:retain_points_multiplier_sequence": 86, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 106.787109, -6.140555 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Dili", "tippecanoe:retain_points_multiplier_sequence": 19 }, "geometry": { "type": "Point", "coordinates": [ 125.595703, -8.581021 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Port Moresby", "tippecanoe:retain_points_multiplier_sequence": 25 }, "geometry": { "type": "Point", "coordinates": [ 147.216797, -9.449062 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Cairo", "tippecanoe:retain_points_multiplier_sequence": 87, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 31.289062, 30.069094 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Tel Aviv-Yafo", "tippecanoe:retain_points_multiplier_sequence": 61 }, "geometry": { "type": "Point", "coordinates": [ 34.804688, 32.101190 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Beirut", "tippecanoe:retain_points_multiplier_sequence": 40 }, "geometry": { "type": "Point", "coordinates": [ 35.507812, 33.870416 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Sao Paulo", "tippecanoe:retain_points_multiplier_sequence": 91, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ -46.669922, -23.563987 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Montevideo", "tippecanoe:retain_points_multiplier_sequence": 17 }, "geometry": { "type": "Point", "coordinates": [ -56.162109, -34.885931 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Rio de Janeiro", "tippecanoe:retain_points_multiplier_sequence": 90 }, "geometry": { "type": "Point", "coordinates": [ -43.242188, -22.917923 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Hong Kong", "tippecanoe:retain_points_multiplier_sequence": 92, "tippecanoe:retain_points_multiplier_first": true }, "geometry": { "type": "Point", "coordinates": [ 114.169922, 22.268764 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Shanghai", "tippecanoe:retain_points_multiplier_sequence": 88 }, "geometry": { "type": "Point", "coordinates": [ 121.464844, 31.203405 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Taipei", "tippecanoe:retain_points_multiplier_sequence": 79 }, "geometry": { "type": "Point", "coordinates": [ 121.552734, 25.005973 ] } }
|
||||
] }
|
||||
] }
|
||||
] }
|
||||
@@ -10,6 +10,7 @@
|
||||
"minzoom": "0",
|
||||
"name": "tests/ne_110m_populated_places/out/-z3_-K20_-r1_-yNAME_-k2.json.check.mbtiles",
|
||||
"strategies": "[{\"coalesced_as_needed\":207},{\"coalesced_as_needed\":174},{\"coalesced_as_needed\":108},{}]",
|
||||
"tippecanoe_decisions": "{\"basezoom\":3,\"droprate\":1,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"maxzoom": "3",
|
||||
"minzoom": "0",
|
||||
"name": "tests/ne_110m_populated_places/out/-z3_-r1_--limit-tile-feature-count_3.json.check.mbtiles",
|
||||
"tippecanoe_decisions": "{\"basezoom\":3,\"droprate\":1,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
+1
@@ -9,6 +9,7 @@
|
||||
"maxzoom": "3",
|
||||
"minzoom": "0",
|
||||
"name": "tests/ne_110m_populated_places/out/-z3_-r1_--limit-tile-feature-count_3_--limit-tile-feature-count-at-maximum-zoom_10.json.check.mbtiles",
|
||||
"tippecanoe_decisions": "{\"basezoom\":3,\"droprate\":1,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
"minzoom": "0",
|
||||
"name": "tests/ne_110m_populated_places/out/-zg_-K20_-r1_-yNAME.json.check.mbtiles",
|
||||
"strategies": "[{\"coalesced_as_needed\":207},{\"coalesced_as_needed\":174},{\"coalesced_as_needed\":108},{\"coalesced_as_needed\":51}]",
|
||||
"tippecanoe_decisions": "{\"basezoom\":3,\"droprate\":1,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
"minzoom": "0",
|
||||
"name": "tests/ne_110m_populated_places/out/-zg_-K20_-r1_-yNAME_-kg.json.check.mbtiles",
|
||||
"strategies": "[{\"coalesced_as_needed\":207},{\"coalesced_as_needed\":174},{\"coalesced_as_needed\":108},{}]",
|
||||
"tippecanoe_decisions": "{\"basezoom\":3,\"droprate\":1,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 0, "x": 0, "y": 0 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 4, "NAME": "Castries" }, "geometry": { "type": "Point", "coordinates": [ -60.996094, 14.008696 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 3, "NAME": "Niamey" }, "geometry": { "type": "Point", "coordinates": [ 2.109375, 13.496473 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 3, "NAME": "Wellington" }, "geometry": { "type": "MultiPoint", "coordinates": [ [ 174.814453, -41.310824 ], [ -185.273438, -41.310824 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 3, "NAME": "Sucre" }, "geometry": { "type": "Point", "coordinates": [ -65.214844, -19.062118 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 3, "NAME": "Hargeysa" }, "geometry": { "type": "Point", "coordinates": [ 44.121094, 9.535749 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 1, "NAME": "Chengdu" }, "geometry": { "type": "Point", "coordinates": [ 104.062500, 30.675715 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 1, "NAME": "Vancouver" }, "geometry": { "type": "Point", "coordinates": [ -123.134766, 49.267805 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 1, "NAME": "Vienna" }, "geometry": { "type": "Point", "coordinates": [ 16.347656, 48.166085 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 0, "NAME": "Cape Town" }, "geometry": { "type": "Point", "coordinates": [ 18.457031, -33.943360 ] } }
|
||||
] }
|
||||
] }
|
||||
@@ -0,0 +1,19 @@
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 0, "x": 0, "y": 0 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 0, "NAME": "Los Angeles" }, "geometry": { "type": "Point", "coordinates": [ -118.125000, 33.943360 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 0, "NAME": "London" }, "geometry": { "type": "Point", "coordinates": [ -0.087891, 51.508742 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 0, "NAME": "Santiago" }, "geometry": { "type": "Point", "coordinates": [ -70.664062, -33.431441 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 0, "NAME": "Rome" }, "geometry": { "type": "Point", "coordinates": [ 12.480469, 41.902277 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 0, "NAME": "Lagos" }, "geometry": { "type": "Point", "coordinates": [ 3.427734, 6.402648 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 0, "NAME": "Riyadh" }, "geometry": { "type": "Point", "coordinates": [ 46.757812, 24.607069 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 0, "NAME": "Singapore" }, "geometry": { "type": "Point", "coordinates": [ 103.886719, 1.230374 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "SCALERANK": 0, "NAME": "Cape Town" }, "geometry": { "type": "Point", "coordinates": [ 18.457031, -33.943360 ] } }
|
||||
] }
|
||||
] }
|
||||
@@ -0,0 +1,21 @@
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 0, "x": 0, "y": 0 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "NAME": "Vancouver,San Francisco,Los Angeles,Denver,Monterrey,Houston,Mexico City,Guatemala,Chicago,Toronto,Ottawa,Atlanta,Havana,Miami,Washington, D.C.,New York,Nassau,Belmopan,Tegucigalpa,San Salvador,Managua,San Jose,Panama City,Kingston,Port-au-Prince,Santo Domingo,Bogota,Basseterre,Saint John's,Roseau" }, "geometry": { "type": "Point", "coordinates": [ -123.134766, 49.267805 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Castries,Kingstown,Saint George's,Bridgetown,Caracas,Port-of-Spain,Georgetown,Paramaribo,Reykjavík,Dublin,London,Praia,Laayoune,Lisbon,Casablanca,Rabat,Madrid,Bir Lehlou,Dakar,Nouakchott,Banjul,Bissau,Conakry,Freetown,Bamako,Ouagadougou,Monrovia,Yamoussoukro,Abidjan,Accra" }, "geometry": { "type": "Point", "coordinates": [ -60.996094, 14.008696 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Nukualofa,Apia,Quito,Lima,La Paz,Valparaiso,Santiago,Sucre,Brasilia,Asuncion,Buenos Aires,Sao Paulo,Montevideo,Rio de Janeiro,Oslo,Stockholm,The Hague,Amsterdam,Brussels,Luxembourg,Paris,Andorra,Geneva,Bern,Vaduz,Monaco,København,Berlin,Prague,Warsaw" }, "geometry": { "type": "MultiPoint", "coordinates": [ [ -175.166016, -21.125498 ], [ 184.833984, -21.125498 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Vienna,Ljubljana,Zagreb,San Marino,Vatican City,Rome,Bratislava,Budapest,Sarajevo,Podgorica,Belgrade,Tirana,Pristina,Skopje,Helsinki,Tallinn,Riga,Vilnius,Minsk,Kiev,Sofia,Bucharest,Chisinau,Istanbul,Moscow,Tbilisi,Algiers,Tunis,Tripoli,Valletta" }, "geometry": { "type": "Point", "coordinates": [ 16.347656, 48.166085 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Niamey,Lome,Cotonou,Porto-Novo,Lagos,Abuja,Sao Tome,Malabo,Libreville,Ndjamena,Yaounde,Bangui,Athens,Ankara,Nicosia,Cairo,Tel Aviv-Yafo,Beirut,Damascus,Yerevan,Baghdad,Jerusalem,Amman,Khartoum,Juba,Kampala,Asmara,Sanaa,Djibouti,Addis Ababa" }, "geometry": { "type": "Point", "coordinates": [ 2.109375, 13.496473 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Hargeysa,Astana,Tashkent,Bishkek,Urumqi,Baku,Tehran,Kuwait,Riyadh,Manama,Doha,Dubai,Abu Dhabi,Ashgabat,Muscat,Mogadishu,Dushanbe,Kabul,Islamabad,New Delhi,Kathmandu,Thimphu,Kolkata,Mumbai,Bangalore,Male,Colombo,Sri Jawewardenepura Kotte,Ulaanbaatar,Dhaka" }, "geometry": { "type": "Point", "coordinates": [ 44.121094, 9.535749 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Chengdu,Naypyidaw,Rangoon,Bangkok,Vientiane,Hanoi,Phnom Penh,Kuala Lumpur,Putrajaya,Singapore,Beijing,Hong Kong,Shanghai,Taipei,Pyongyang,Seoul,Baguio City,Manila,Bandar Seri Begawan,Melekeok,Osaka,Kyoto,Tokyo,Palikir,Majuro,Tarawa,Brazzaville,Kinshasa,Luanda,Windhoek" }, "geometry": { "type": "Point", "coordinates": [ 104.062500, 30.675715 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Cape Town,Kigali,Bujumbura,Lusaka,Harare,Nairobi,Dodoma,Dar es Salaam,Lilongwe,Moroni,Gaborone,Johannesburg,Bloemfontein,Maseru,Pretoria,Mbabane,Lobamba,Maputo,Victoria,Antananarivo,Port Louis,Jakarta,Dili,Port Moresby,Melbourne,Sydney,Canberra,Honiara,Port Vila,Funafuti" }, "geometry": { "type": "Point", "coordinates": [ 18.457031, -33.943360 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Suva,Auckland,Wellington" }, "geometry": { "type": "MultiPoint", "coordinates": [ [ 178.505859, -18.145852 ], [ -181.582031, -18.145852 ] ] } }
|
||||
] }
|
||||
] }
|
||||
@@ -0,0 +1,57 @@
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 0, "x": 0, "y": 0 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "NAME": "Los Angeles" }, "geometry": { "type": "Point", "coordinates": [ -118.125000, 33.943360 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Mexico City" }, "geometry": { "type": "Point", "coordinates": [ -99.140625, 19.394068 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Washington, D.C." }, "geometry": { "type": "Point", "coordinates": [ -76.992188, 38.891033 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "New York" }, "geometry": { "type": "Point", "coordinates": [ -74.003906, 40.713956 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Bogota" }, "geometry": { "type": "Point", "coordinates": [ -74.091797, 4.565474 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "London" }, "geometry": { "type": "Point", "coordinates": [ -0.087891, 51.508742 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Santiago" }, "geometry": { "type": "Point", "coordinates": [ -70.664062, -33.431441 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Sao Paulo" }, "geometry": { "type": "Point", "coordinates": [ -46.582031, -23.563987 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Rio de Janeiro" }, "geometry": { "type": "Point", "coordinates": [ -43.242188, -22.917923 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Paris" }, "geometry": { "type": "Point", "coordinates": [ 2.373047, 48.864715 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Rome" }, "geometry": { "type": "Point", "coordinates": [ 12.480469, 41.902277 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Istanbul" }, "geometry": { "type": "Point", "coordinates": [ 29.003906, 41.112469 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Moscow" }, "geometry": { "type": "Point", "coordinates": [ 37.617188, 55.727110 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Lagos" }, "geometry": { "type": "Point", "coordinates": [ 3.427734, 6.402648 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Cairo" }, "geometry": { "type": "Point", "coordinates": [ 31.289062, 30.069094 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Riyadh" }, "geometry": { "type": "Point", "coordinates": [ 46.757812, 24.607069 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Kolkata" }, "geometry": { "type": "Point", "coordinates": [ 88.330078, 22.512557 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Mumbai" }, "geometry": { "type": "Point", "coordinates": [ 72.861328, 18.979026 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Singapore" }, "geometry": { "type": "Point", "coordinates": [ 103.886719, 1.230374 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Beijing" }, "geometry": { "type": "Point", "coordinates": [ 116.367188, 39.909736 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Hong Kong" }, "geometry": { "type": "Point", "coordinates": [ 114.169922, 22.268764 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Shanghai" }, "geometry": { "type": "Point", "coordinates": [ 121.464844, 31.203405 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Tokyo" }, "geometry": { "type": "Point", "coordinates": [ 139.746094, 35.675147 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Cape Town" }, "geometry": { "type": "Point", "coordinates": [ 18.457031, -33.943360 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Nairobi" }, "geometry": { "type": "Point", "coordinates": [ 36.826172, -1.318243 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Jakarta" }, "geometry": { "type": "Point", "coordinates": [ 106.875000, -6.227934 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Sydney" }, "geometry": { "type": "Point", "coordinates": [ 151.171875, -33.943360 ] } }
|
||||
] }
|
||||
] }
|
||||
@@ -0,0 +1,21 @@
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 0, "x": 0, "y": 0 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "NAME": "Vancouver" }, "geometry": { "type": "Point", "coordinates": [ -123.134766, 49.267805 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Castries" }, "geometry": { "type": "Point", "coordinates": [ -60.996094, 14.008696 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Nukualofa" }, "geometry": { "type": "MultiPoint", "coordinates": [ [ -175.166016, -21.125498 ], [ 184.833984, -21.125498 ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Vienna" }, "geometry": { "type": "Point", "coordinates": [ 16.347656, 48.166085 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Niamey" }, "geometry": { "type": "Point", "coordinates": [ 2.109375, 13.496473 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Hargeysa" }, "geometry": { "type": "Point", "coordinates": [ 44.121094, 9.535749 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Chengdu" }, "geometry": { "type": "Point", "coordinates": [ 104.062500, 30.675715 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Cape Town" }, "geometry": { "type": "Point", "coordinates": [ 18.457031, -33.943360 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "NAME": "Suva" }, "geometry": { "type": "MultiPoint", "coordinates": [ [ 178.505859, -18.145852 ], [ -181.582031, -18.145852 ] ] } }
|
||||
] }
|
||||
] }
|
||||
Binary file not shown.
@@ -9,6 +9,7 @@
|
||||
"maxzoom": "14",
|
||||
"minzoom": "0",
|
||||
"name": "tests/pmtiles/hackspots.pmtiles",
|
||||
"tippecanoe_decisions": "{\"basezoom\":14,\"droprate\":1,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"maxzoom": "14",
|
||||
"minzoom": "0",
|
||||
"name": "tests/raw-tiles/raw-tiles",
|
||||
"tippecanoe_decisions": "{\"basezoom\":14,\"droprate\":1,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"maxzoom": "14",
|
||||
"minzoom": "0",
|
||||
"name": "tests/raw-tiles/raw-tiles",
|
||||
"tippecanoe_decisions": "{\"basezoom\":14,\"droprate\":1,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"maxzoom": "3",
|
||||
"minzoom": "0",
|
||||
"name": "tests/stable/out/-z3_-B0.json.check.mbtiles",
|
||||
"tippecanoe_decisions": "{\"basezoom\":0,\"droprate\":2.5,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
+26
-109
@@ -70,21 +70,6 @@ struct stats {
|
||||
std::vector<struct strategy> strategies;
|
||||
};
|
||||
|
||||
void aprintf(std::string *buf, const char *format, ...) {
|
||||
va_list ap;
|
||||
char *tmp;
|
||||
|
||||
va_start(ap, format);
|
||||
if (vasprintf(&tmp, format, ap) < 0) {
|
||||
fprintf(stderr, "memory allocation failure\n");
|
||||
exit(EXIT_MEMORY);
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
buf->append(tmp, strlen(tmp));
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
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) {
|
||||
mvt_tile tile;
|
||||
int features_added = 0;
|
||||
@@ -149,52 +134,14 @@ void append_tile(std::string message, int z, unsigned x, unsigned y, std::map<st
|
||||
}
|
||||
}
|
||||
|
||||
auto file_keys = layermap.find(layer.name);
|
||||
auto tilestats = layermap.find(layer.name);
|
||||
|
||||
for (size_t f = 0; f < layer.features.size(); f++) {
|
||||
mvt_feature feat = layer.features[f];
|
||||
std::set<std::string> exclude_attributes;
|
||||
|
||||
if (filter != NULL) {
|
||||
std::map<std::string, mvt_value> attributes;
|
||||
|
||||
for (size_t t = 0; t + 1 < feat.tags.size(); t += 2) {
|
||||
std::string key = layer.keys[feat.tags[t]];
|
||||
mvt_value &val = layer.values[feat.tags[t + 1]];
|
||||
|
||||
attributes.insert(std::pair<std::string, mvt_value>(key, val));
|
||||
}
|
||||
|
||||
if (feat.has_id) {
|
||||
mvt_value v;
|
||||
v.type = mvt_uint;
|
||||
v.numeric_value.uint_value = feat.id;
|
||||
|
||||
attributes.insert(std::pair<std::string, mvt_value>("$id", v));
|
||||
}
|
||||
|
||||
mvt_value v;
|
||||
v.type = mvt_string;
|
||||
|
||||
if (feat.type == mvt_point) {
|
||||
v.string_value = "Point";
|
||||
} else if (feat.type == mvt_linestring) {
|
||||
v.string_value = "LineString";
|
||||
} else if (feat.type == mvt_polygon) {
|
||||
v.string_value = "Polygon";
|
||||
}
|
||||
|
||||
attributes.insert(std::pair<std::string, mvt_value>("$type", v));
|
||||
|
||||
mvt_value v2;
|
||||
v2.type = mvt_uint;
|
||||
v2.numeric_value.uint_value = z;
|
||||
|
||||
attributes.insert(std::pair<std::string, mvt_value>("$zoom", v2));
|
||||
|
||||
if (!evaluate(attributes, layer.name, filter, exclude_attributes)) {
|
||||
continue;
|
||||
}
|
||||
if (!evaluate(feat, layer, filter, exclude_attributes, z)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
mvt_feature outfeature;
|
||||
@@ -205,55 +152,25 @@ void append_tile(std::string message, int z, unsigned x, unsigned y, std::map<st
|
||||
outfeature.id = feat.id;
|
||||
}
|
||||
|
||||
std::map<std::string, std::pair<mvt_value, type_and_string>> attributes;
|
||||
std::map<std::string, std::pair<mvt_value, serial_val>> attributes;
|
||||
std::vector<std::string> key_order;
|
||||
|
||||
for (size_t t = 0; t + 1 < feat.tags.size(); t += 2) {
|
||||
const char *key = layer.keys[feat.tags[t]].c_str();
|
||||
mvt_value &val = layer.values[feat.tags[t + 1]];
|
||||
std::string value;
|
||||
int type = -1;
|
||||
serial_val sv = mvt_value_to_serial_val(val);
|
||||
|
||||
if (val.type == mvt_string) {
|
||||
value = val.string_value;
|
||||
type = mvt_string;
|
||||
} else if (val.type == mvt_int) {
|
||||
aprintf(&value, "%lld", (long long) val.numeric_value.int_value);
|
||||
type = mvt_double;
|
||||
} else if (val.type == mvt_double) {
|
||||
aprintf(&value, "%s", milo::dtoa_milo(val.numeric_value.double_value).c_str());
|
||||
type = mvt_double;
|
||||
} else if (val.type == mvt_float) {
|
||||
aprintf(&value, "%s", milo::dtoa_milo(val.numeric_value.float_value).c_str());
|
||||
type = mvt_double;
|
||||
} else if (val.type == mvt_bool) {
|
||||
aprintf(&value, "%s", val.numeric_value.bool_value ? "true" : "false");
|
||||
type = mvt_bool;
|
||||
} else if (val.type == mvt_sint) {
|
||||
aprintf(&value, "%lld", (long long) val.numeric_value.sint_value);
|
||||
type = mvt_double;
|
||||
} else if (val.type == mvt_uint) {
|
||||
aprintf(&value, "%llu", (long long) val.numeric_value.uint_value);
|
||||
type = mvt_double;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (type < 0) {
|
||||
if (sv.type == mvt_null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (include.count(std::string(key)) || (!exclude_all && exclude.count(std::string(key)) == 0 && exclude_attributes.count(std::string(key)) == 0)) {
|
||||
type_and_string tas;
|
||||
tas.type = type;
|
||||
tas.string = value;
|
||||
|
||||
attributes.insert(std::pair<std::string, std::pair<mvt_value, type_and_string>>(key, std::pair<mvt_value, type_and_string>(val, tas)));
|
||||
attributes.insert(std::pair<std::string, std::pair<mvt_value, serial_val>>(key, std::pair<mvt_value, serial_val>(val, sv)));
|
||||
key_order.push_back(key);
|
||||
}
|
||||
|
||||
if (header.size() > 0 && strcmp(key, header[0].c_str()) == 0) {
|
||||
std::map<std::string, std::vector<std::string>>::iterator ii = mapping.find(value);
|
||||
std::map<std::string, std::vector<std::string>>::iterator ii = mapping.find(sv.s);
|
||||
|
||||
if (ii != mapping.end()) {
|
||||
std::vector<std::string> fields = ii->second;
|
||||
@@ -291,14 +208,14 @@ void append_tile(std::string message, int z, unsigned x, unsigned y, std::map<st
|
||||
attributes.erase(fa);
|
||||
}
|
||||
|
||||
type_and_string tas;
|
||||
tas.type = outval.type;
|
||||
tas.string = joinval;
|
||||
serial_val outsv;
|
||||
outsv.type = outval.type;
|
||||
outsv.s = joinval;
|
||||
|
||||
// Convert from double to int if the joined attribute is an integer
|
||||
outval = stringified_to_mvt_value(outval.type, joinval.c_str());
|
||||
|
||||
attributes.insert(std::pair<std::string, std::pair<mvt_value, type_and_string>>(joinkey, std::pair<mvt_value, type_and_string>(outval, tas)));
|
||||
attributes.insert(std::pair<std::string, std::pair<mvt_value, serial_val>>(joinkey, std::pair<mvt_value, serial_val>(outval, outsv)));
|
||||
key_order.push_back(joinkey);
|
||||
}
|
||||
}
|
||||
@@ -307,11 +224,11 @@ void append_tile(std::string message, int z, unsigned x, unsigned y, std::map<st
|
||||
}
|
||||
|
||||
if (matched || !ifmatched) {
|
||||
if (file_keys == layermap.end()) {
|
||||
if (tilestats == layermap.end()) {
|
||||
layermap.insert(std::pair<std::string, layermap_entry>(layer.name, layermap_entry(layermap.size())));
|
||||
file_keys = layermap.find(layer.name);
|
||||
file_keys->second.minzoom = z;
|
||||
file_keys->second.maxzoom = z;
|
||||
tilestats = layermap.find(layer.name);
|
||||
tilestats->second.minzoom = z;
|
||||
tilestats->second.maxzoom = z;
|
||||
}
|
||||
|
||||
// To keep attributes in their original order instead of alphabetical
|
||||
@@ -320,7 +237,7 @@ void append_tile(std::string message, int z, unsigned x, unsigned y, std::map<st
|
||||
|
||||
if (fa != attributes.end()) {
|
||||
outlayer.tag(outfeature, k, fa->second.first);
|
||||
add_to_file_keys(file_keys->second.file_keys, k, fa->second.second);
|
||||
add_to_tilestats(tilestats->second.tilestats, k, fa->second.second);
|
||||
attributes.erase(fa);
|
||||
}
|
||||
}
|
||||
@@ -338,19 +255,19 @@ void append_tile(std::string message, int z, unsigned x, unsigned y, std::map<st
|
||||
features_added++;
|
||||
outlayer.features.push_back(outfeature);
|
||||
|
||||
if (z < file_keys->second.minzoom) {
|
||||
file_keys->second.minzoom = z;
|
||||
if (z < tilestats->second.minzoom) {
|
||||
tilestats->second.minzoom = z;
|
||||
}
|
||||
if (z > file_keys->second.maxzoom) {
|
||||
file_keys->second.maxzoom = z;
|
||||
if (z > tilestats->second.maxzoom) {
|
||||
tilestats->second.maxzoom = z;
|
||||
}
|
||||
|
||||
if (feat.type == mvt_point) {
|
||||
file_keys->second.points++;
|
||||
tilestats->second.points++;
|
||||
} else if (feat.type == mvt_linestring) {
|
||||
file_keys->second.lines++;
|
||||
tilestats->second.lines++;
|
||||
} else if (feat.type == mvt_polygon) {
|
||||
file_keys->second.polygons++;
|
||||
tilestats->second.polygons++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -782,7 +699,7 @@ struct tileset_reader {
|
||||
}
|
||||
|
||||
if (source.layers.size() != 0) {
|
||||
std::string ret = overzoom(source, parent_tile.z, parent_tile.x, parent_tile.y, tile.z, tile.x, tile.y, -1, buffer, std::set<std::string>(), false, &next_overzoomed_tiles);
|
||||
std::string ret = overzoom(source, parent_tile.z, parent_tile.x, parent_tile.y, tile.z, tile.x, tile.y, -1, buffer, std::set<std::string>(), false, &next_overzoomed_tiles, false, NULL, false, std::map<std::string, attribute_op>());
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1606,7 +1523,7 @@ int main(int argc, char **argv) {
|
||||
st.maxlon2 = st.maxlon;
|
||||
}
|
||||
|
||||
metadata m = make_metadata(name.c_str(), st.minzoom, st.maxzoom, st.minlat, st.minlon, st.maxlat, st.maxlon, st.minlat2, st.minlon2, st.maxlat2, st.maxlon2, st.midlat, st.midlon, attribution.size() != 0 ? attribution.c_str() : NULL, layermap, true, description.c_str(), !pg, attribute_descriptions, "tile-join", generator_options, strategies);
|
||||
metadata m = make_metadata(name.c_str(), st.minzoom, st.maxzoom, st.minlat, st.minlon, st.maxlat, st.maxlon, st.minlat2, st.minlon2, st.maxlat2, st.maxlon2, st.midlat, st.midlon, attribution.size() != 0 ? attribution.c_str() : NULL, layermap, true, description.c_str(), !pg, attribute_descriptions, "tile-join", generator_options, strategies, st.maxzoom, 2.5, 1);
|
||||
|
||||
if (outdb != NULL) {
|
||||
mbtiles_write_metadata(outdb, m, true);
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "errors.hpp"
|
||||
#include "compression.hpp"
|
||||
#include "protozero/varint.hpp"
|
||||
#include "attribute.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include "jsonpull/jsonpull.h"
|
||||
@@ -111,7 +112,11 @@ struct coalesce {
|
||||
}
|
||||
};
|
||||
|
||||
struct preservecmp {
|
||||
static struct preservecmp {
|
||||
bool operator()(const std::vector<struct coalesce> &a, const std::vector<struct coalesce> &b) {
|
||||
return operator()(a[0], b[0]);
|
||||
}
|
||||
|
||||
bool operator()(const struct coalesce &a, const struct coalesce &b) {
|
||||
return a.original_seq < b.original_seq;
|
||||
}
|
||||
@@ -303,6 +308,10 @@ static mvt_value coerce_double(mvt_value v) {
|
||||
}
|
||||
|
||||
struct ordercmp {
|
||||
bool operator()(const std::vector<struct coalesce> &a, const std::vector<struct coalesce> &b) {
|
||||
return operator()(a[0], b[0]);
|
||||
}
|
||||
|
||||
bool operator()(const struct coalesce &a, const struct coalesce &b) {
|
||||
for (size_t i = 0; i < order_by.size(); i++) {
|
||||
mvt_value v1 = coerce_double(find_attribute_value(&a, order_by[i].name));
|
||||
@@ -331,6 +340,66 @@ struct ordercmp {
|
||||
}
|
||||
} ordercmp;
|
||||
|
||||
std::vector<std::vector<coalesce>> assemble_multiplier_clusters(std::vector<coalesce> &features) {
|
||||
std::vector<std::vector<coalesce>> clusters;
|
||||
|
||||
if (retain_points_multiplier == 1) {
|
||||
for (auto const &feature : features) {
|
||||
std::vector<coalesce> cluster;
|
||||
cluster.push_back(feature);
|
||||
clusters.push_back(cluster);
|
||||
}
|
||||
} else {
|
||||
for (auto const &feature : features) {
|
||||
bool is_cluster_start = false;
|
||||
|
||||
for (size_t i = 0; i < feature.full_keys.size(); i++) {
|
||||
if (feature.full_keys[i] == "tippecanoe:retain_points_multiplier_first") {
|
||||
is_cluster_start = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_cluster_start) {
|
||||
clusters.push_back(std::vector<coalesce>());
|
||||
}
|
||||
|
||||
clusters.back().push_back(feature);
|
||||
}
|
||||
}
|
||||
|
||||
return clusters;
|
||||
}
|
||||
|
||||
std::vector<coalesce> disassemble_multiplier_clusters(std::vector<std::vector<coalesce>> &clusters) {
|
||||
std::vector<coalesce> out;
|
||||
|
||||
for (auto &cluster : clusters) {
|
||||
// fix up the attributes so the first feature of the multiplier cluster
|
||||
// gets the marker attribute
|
||||
for (size_t i = 0; i < cluster.size(); i++) {
|
||||
for (size_t j = 0; j < cluster[i].full_keys.size(); j++) {
|
||||
if (cluster[i].full_keys[j] == "tippecanoe:retain_points_multiplier_first") {
|
||||
cluster[0].full_keys.push_back(cluster[i].full_keys[j]);
|
||||
cluster[0].full_values.push_back(cluster[i].full_values[j]);
|
||||
|
||||
cluster[i].full_keys.erase(cluster[i].full_keys.begin() + j);
|
||||
cluster[i].full_values.erase(cluster[i].full_values.begin() + j);
|
||||
|
||||
i = cluster.size(); // break outer
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto const &feature : cluster) {
|
||||
out.push_back(feature);
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
void rewrite(drawvec &geom, int z, int nextzoom, int maxzoom, long long *bbox, unsigned tx, unsigned ty, int buffer, int *within, std::atomic<long long> *geompos, compressor **geomfile, const char *fname, signed char t, int layer, signed char feature_minzoom, int child_shards, int max_zoom_increment, long long seq, int tippecanoe_minzoom, int tippecanoe_maxzoom, int segment, unsigned *initial_x, unsigned *initial_y, std::vector<long long> &metakeys, std::vector<long long> &metavals, bool has_id, unsigned long long id, unsigned long long index, unsigned long long label_point, long long extent) {
|
||||
if (geom.size() > 0 && (nextzoom <= maxzoom || additional[A_EXTEND_ZOOMS] || extend_zooms_max > 0)) {
|
||||
int xo, yo;
|
||||
@@ -439,11 +508,6 @@ void rewrite(drawvec &geom, int z, int nextzoom, int maxzoom, long long *bbox, u
|
||||
}
|
||||
}
|
||||
|
||||
struct accum_state {
|
||||
double sum = 0;
|
||||
double count = 0;
|
||||
};
|
||||
|
||||
struct partial {
|
||||
std::vector<drawvec> geoms = std::vector<drawvec>();
|
||||
std::vector<long long> keys = std::vector<long long>();
|
||||
@@ -1456,7 +1520,11 @@ void remove_attributes(serial_feature &sf, std::set<std::string> const &exclude_
|
||||
}
|
||||
}
|
||||
|
||||
serial_feature next_feature(decompressor *geoms, std::atomic<long long> *geompos_in, int z, unsigned tx, unsigned ty, unsigned *initial_x, unsigned *initial_y, long long *original_features, long long *unclipped_features, int nextzoom, int maxzoom, int minzoom, int max_zoom_increment, size_t pass, std::atomic<long long> *along, long long alongminus, int buffer, int *within, compressor **geomfile, std::atomic<long long> *geompos, std::atomic<double> *oprogress, double todo, const char *fname, int child_shards, struct json_object *filter, const char *stringpool, long long *pool_off, std::vector<std::vector<std::string>> *layer_unmaps, bool first_time, bool compressed) {
|
||||
struct multiplier_state {
|
||||
std::map<std::string, size_t> count;
|
||||
};
|
||||
|
||||
serial_feature next_feature(decompressor *geoms, std::atomic<long long> *geompos_in, int z, unsigned tx, unsigned ty, unsigned *initial_x, unsigned *initial_y, long long *original_features, long long *unclipped_features, int nextzoom, int maxzoom, int minzoom, int max_zoom_increment, size_t pass, std::atomic<long long> *along, long long alongminus, int buffer, int *within, compressor **geomfile, std::atomic<long long> *geompos, std::atomic<double> *oprogress, double todo, const char *fname, int child_shards, struct json_object *filter, const char *stringpool, long long *pool_off, std::vector<std::vector<std::string>> *layer_unmaps, bool first_time, bool compressed, multiplier_state *multiplier_state) {
|
||||
while (1) {
|
||||
serial_feature sf;
|
||||
std::string s;
|
||||
@@ -1583,8 +1651,36 @@ serial_feature next_feature(decompressor *geoms, std::atomic<long long> *geompos
|
||||
}
|
||||
}
|
||||
|
||||
if (sf.tippecanoe_minzoom == -1 && z < sf.feature_minzoom) {
|
||||
if (sf.tippecanoe_minzoom == -1) {
|
||||
bool keep = false;
|
||||
|
||||
std::string layername = (*layer_unmaps)[sf.segment][sf.layer];
|
||||
auto count = multiplier_state->count.find(layername);
|
||||
if (count == multiplier_state->count.end()) {
|
||||
multiplier_state->count.emplace(layername, 0);
|
||||
count = multiplier_state->count.find(layername);
|
||||
keep = true; // the first feature in each layer in each tile is always kept
|
||||
}
|
||||
|
||||
sf.dropped = true;
|
||||
|
||||
if (z >= sf.feature_minzoom || keep) {
|
||||
count->second = retain_points_multiplier;
|
||||
|
||||
if (retain_points_multiplier > 1) {
|
||||
serial_val val;
|
||||
val.type = mvt_bool;
|
||||
val.s = "true";
|
||||
|
||||
sf.full_keys.push_back("tippecanoe:retain_points_multiplier_first");
|
||||
sf.full_values.push_back(val);
|
||||
}
|
||||
}
|
||||
|
||||
if (count->second > 0) {
|
||||
sf.dropped = false;
|
||||
count->second -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove nulls, now that the expression evaluation filter has run
|
||||
@@ -1646,9 +1742,10 @@ struct run_prefilter_args {
|
||||
void *run_prefilter(void *v) {
|
||||
run_prefilter_args *rpa = (run_prefilter_args *) v;
|
||||
json_writer state(rpa->prefilter_fp);
|
||||
struct multiplier_state multiplier_state;
|
||||
|
||||
while (1) {
|
||||
serial_feature sf = next_feature(rpa->geoms, rpa->geompos_in, rpa->z, rpa->tx, rpa->ty, rpa->initial_x, rpa->initial_y, rpa->original_features, rpa->unclipped_features, rpa->nextzoom, rpa->maxzoom, rpa->minzoom, rpa->max_zoom_increment, rpa->pass, rpa->along, rpa->alongminus, rpa->buffer, rpa->within, rpa->geomfile, rpa->geompos, rpa->oprogress, rpa->todo, rpa->fname, rpa->child_shards, rpa->filter, rpa->stringpool, rpa->pool_off, rpa->layer_unmaps, rpa->first_time, rpa->compressed);
|
||||
serial_feature sf = next_feature(rpa->geoms, rpa->geompos_in, rpa->z, rpa->tx, rpa->ty, rpa->initial_x, rpa->initial_y, rpa->original_features, rpa->unclipped_features, rpa->nextzoom, rpa->maxzoom, rpa->minzoom, rpa->max_zoom_increment, rpa->pass, rpa->along, rpa->alongminus, rpa->buffer, rpa->within, rpa->geomfile, rpa->geompos, rpa->oprogress, rpa->todo, rpa->fname, rpa->child_shards, rpa->filter, rpa->stringpool, rpa->pool_off, rpa->layer_unmaps, rpa->first_time, rpa->compressed, &multiplier_state);
|
||||
if (sf.t < 0) {
|
||||
break;
|
||||
}
|
||||
@@ -1715,20 +1812,16 @@ void add_tilestats(std::string const &layername, int z, std::vector<std::map<std
|
||||
(*layer_unmaps)[tiling_seg][lme.id] = layername;
|
||||
}
|
||||
}
|
||||
auto fk = layermap.find(layername);
|
||||
if (fk == layermap.end()) {
|
||||
auto ts = layermap.find(layername);
|
||||
if (ts == layermap.end()) {
|
||||
fprintf(stderr, "Internal error: layer %s not found\n", layername.c_str());
|
||||
exit(EXIT_IMPOSSIBLE);
|
||||
}
|
||||
|
||||
type_and_string attrib;
|
||||
attrib.type = val.type;
|
||||
attrib.string = val.s;
|
||||
|
||||
add_to_file_keys(fk->second.file_keys, key, attrib);
|
||||
add_to_tilestats(ts->second.tilestats, key, val);
|
||||
}
|
||||
|
||||
void preserve_attribute(attribute_op op, serial_feature &, char *stringpool, long long *pool_off, std::string &key, serial_val &val, partial &p) {
|
||||
void promote_attribute(std::string const &key, partial &p, char *stringpool, long long *pool_off) {
|
||||
if (p.need_tilestats.count(key) == 0) {
|
||||
p.need_tilestats.insert(key);
|
||||
}
|
||||
@@ -1751,70 +1844,6 @@ void preserve_attribute(attribute_op op, serial_feature &, char *stringpool, lon
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < p.full_keys.size(); i++) {
|
||||
if (key == p.full_keys[i]) {
|
||||
switch (op) {
|
||||
case op_sum:
|
||||
p.full_values[i].s = milo::dtoa_milo(atof(p.full_values[i].s.c_str()) + atof(val.s.c_str()));
|
||||
p.full_values[i].type = mvt_double;
|
||||
break;
|
||||
|
||||
case op_product:
|
||||
p.full_values[i].s = milo::dtoa_milo(atof(p.full_values[i].s.c_str()) * atof(val.s.c_str()));
|
||||
p.full_values[i].type = mvt_double;
|
||||
break;
|
||||
|
||||
case op_max: {
|
||||
double existing = atof(p.full_values[i].s.c_str());
|
||||
double maybe = atof(val.s.c_str());
|
||||
if (maybe > existing) {
|
||||
p.full_values[i].s = val.s.c_str();
|
||||
p.full_values[i].type = mvt_double;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case op_min: {
|
||||
double existing = atof(p.full_values[i].s.c_str());
|
||||
double maybe = atof(val.s.c_str());
|
||||
if (maybe < existing) {
|
||||
p.full_values[i].s = val.s.c_str();
|
||||
p.full_values[i].type = mvt_double;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case op_mean: {
|
||||
auto state = p.attribute_accum_state.find(key);
|
||||
if (state == p.attribute_accum_state.end()) {
|
||||
accum_state s;
|
||||
s.sum = atof(p.full_values[i].s.c_str()) + atof(val.s.c_str());
|
||||
s.count = 2;
|
||||
p.attribute_accum_state.insert(std::pair<std::string, accum_state>(key, s));
|
||||
|
||||
p.full_values[i].s = milo::dtoa_milo(s.sum / s.count);
|
||||
} else {
|
||||
state->second.sum += atof(val.s.c_str());
|
||||
state->second.count += 1;
|
||||
|
||||
p.full_values[i].s = milo::dtoa_milo(state->second.sum / state->second.count);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case op_concat:
|
||||
p.full_values[i].s += val.s;
|
||||
p.full_values[i].type = mvt_string;
|
||||
break;
|
||||
|
||||
case op_comma:
|
||||
p.full_values[i].s += std::string(",") + val.s;
|
||||
p.full_values[i].type = mvt_string;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void preserve_attributes(std::map<std::string, attribute_op> const *attribute_accum, serial_feature &sf, char *stringpool, long long *pool_off, partial &p) {
|
||||
@@ -1827,7 +1856,8 @@ void preserve_attributes(std::map<std::string, attribute_op> const *attribute_ac
|
||||
|
||||
auto f = attribute_accum->find(key);
|
||||
if (f != attribute_accum->end()) {
|
||||
preserve_attribute(f->second, sf, stringpool, pool_off, key, sv, p);
|
||||
promote_attribute(key, p, stringpool, pool_off);
|
||||
preserve_attribute(f->second, key, sv, p.full_keys, p.full_values, p.attribute_accum_state);
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; i < sf.full_keys.size(); i++) {
|
||||
@@ -1836,20 +1866,33 @@ void preserve_attributes(std::map<std::string, attribute_op> const *attribute_ac
|
||||
|
||||
auto f = attribute_accum->find(key);
|
||||
if (f != attribute_accum->end()) {
|
||||
preserve_attribute(f->second, sf, stringpool, pool_off, key, sv, p);
|
||||
promote_attribute(key, p, stringpool, pool_off);
|
||||
preserve_attribute(f->second, key, sv, p.full_keys, p.full_values, p.attribute_accum_state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool find_partial(std::vector<partial> &partials, serial_feature &sf, ssize_t &out, std::vector<std::vector<std::string>> *layer_unmaps, long long maxextent) {
|
||||
// This function finds the feature in `partials` onto which the attributes or geometry
|
||||
// of a feature that is being dropped (`sf`) will be accumulated or coalesced. It
|
||||
// ordinarily returns the most recently-added feature from the same layer as the feature
|
||||
// that is being dropped, but if there is an active multiplier, will walk multiple
|
||||
// features backward so that the features being dropped will be accumulated round-robin
|
||||
// onto the N features that are being kept. The caller increments the `multiplier_seq`
|
||||
// mod N with each dropped feature to drive the round-robin decision.
|
||||
//
|
||||
bool find_partial(std::vector<partial> &partials, serial_feature &sf, ssize_t &out, std::vector<std::vector<std::string>> *layer_unmaps, long long maxextent, ssize_t multiplier_seq) {
|
||||
for (size_t i = partials.size(); i > 0; i--) {
|
||||
if (partials[i - 1].t == sf.t) {
|
||||
std::string &layername1 = (*layer_unmaps)[partials[i - 1].segment][partials[i - 1].layer];
|
||||
std::string &layername2 = (*layer_unmaps)[sf.segment][sf.layer];
|
||||
|
||||
if (layername1 == layername2 && partials[i - 1].extent <= maxextent) {
|
||||
out = i - 1;
|
||||
return true;
|
||||
if (multiplier_seq <= 0) {
|
||||
out = i - 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
multiplier_seq--;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2069,12 +2112,14 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
prefilter_jp = json_begin_file(prefilter_read_fp);
|
||||
}
|
||||
|
||||
struct multiplier_state multiplier_state;
|
||||
size_t multiplier_seq = retain_points_multiplier - 1;
|
||||
for (size_t seq = 0;; seq++) {
|
||||
serial_feature sf;
|
||||
ssize_t which_partial = -1;
|
||||
|
||||
if (prefilter == NULL) {
|
||||
sf = next_feature(geoms, geompos_in, z, tx, ty, initial_x, initial_y, &original_features, &unclipped_features, nextzoom, maxzoom, minzoom, max_zoom_increment, pass, along, alongminus, buffer, within, geomfile, geompos, &oprogress, todo, fname, child_shards, filter, stringpool, pool_off, layer_unmaps, first_time, compressed_input);
|
||||
sf = next_feature(geoms, geompos_in, z, tx, ty, initial_x, initial_y, &original_features, &unclipped_features, nextzoom, maxzoom, minzoom, max_zoom_increment, pass, along, alongminus, buffer, within, geomfile, geompos, &oprogress, todo, fname, child_shards, filter, stringpool, pool_off, layer_unmaps, first_time, compressed_input, &multiplier_state);
|
||||
} else {
|
||||
sf = parse_feature(prefilter_jp, z, tx, ty, layermaps, tiling_seg, layer_unmaps, postfilter != NULL);
|
||||
}
|
||||
@@ -2098,15 +2143,19 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
}
|
||||
|
||||
if (sf.dropped) {
|
||||
if (find_partial(partials, sf, which_partial, layer_unmaps, LLONG_MAX)) {
|
||||
multiplier_seq = (multiplier_seq + 1) % retain_points_multiplier;
|
||||
|
||||
if (find_partial(partials, sf, which_partial, layer_unmaps, LLONG_MAX, multiplier_seq)) {
|
||||
preserve_attributes(arg->attribute_accum, sf, stringpool, pool_off, partials[which_partial]);
|
||||
strategy->dropped_by_rate++;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
multiplier_seq = retain_points_multiplier - 1;
|
||||
}
|
||||
|
||||
if (gamma > 0) {
|
||||
if (manage_gap(sf.index, &previndex, scale, gamma, &gap) && find_partial(partials, sf, which_partial, layer_unmaps, LLONG_MAX)) {
|
||||
if (manage_gap(sf.index, &previndex, scale, gamma, &gap) && find_partial(partials, sf, which_partial, layer_unmaps, LLONG_MAX, multiplier_seq)) {
|
||||
preserve_attributes(arg->attribute_accum, sf, stringpool, pool_off, partials[which_partial]);
|
||||
strategy->dropped_by_gamma++;
|
||||
continue;
|
||||
@@ -2125,7 +2174,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
if (indices.size() < MAX_INDICES) {
|
||||
indices.push_back(sf.index);
|
||||
}
|
||||
if ((sf.index < merge_previndex || sf.index - merge_previndex < mingap) && find_partial(partials, sf, which_partial, layer_unmaps, LLONG_MAX)) {
|
||||
if ((sf.index < merge_previndex || sf.index - merge_previndex < mingap) && find_partial(partials, sf, which_partial, layer_unmaps, LLONG_MAX, multiplier_seq)) {
|
||||
partials[which_partial].clustered++;
|
||||
|
||||
if (partials[which_partial].t == VT_POINT &&
|
||||
@@ -2148,7 +2197,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
if (indices.size() < MAX_INDICES) {
|
||||
indices.push_back(sf.index);
|
||||
}
|
||||
if (sf.index - merge_previndex < mingap && find_partial(partials, sf, which_partial, layer_unmaps, LLONG_MAX)) {
|
||||
if (sf.index - merge_previndex < mingap && find_partial(partials, sf, which_partial, layer_unmaps, LLONG_MAX, multiplier_seq)) {
|
||||
preserve_attributes(arg->attribute_accum, sf, stringpool, pool_off, partials[which_partial]);
|
||||
strategy->dropped_as_needed++;
|
||||
continue;
|
||||
@@ -2157,7 +2206,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
if (indices.size() < MAX_INDICES) {
|
||||
indices.push_back(sf.index);
|
||||
}
|
||||
if (sf.index - merge_previndex < mingap && find_partial(partials, sf, which_partial, layer_unmaps, LLONG_MAX)) {
|
||||
if (sf.index - merge_previndex < mingap && find_partial(partials, sf, which_partial, layer_unmaps, LLONG_MAX, multiplier_seq)) {
|
||||
coalesce_geometry(partials[which_partial], sf);
|
||||
partials[which_partial].coalesced = true;
|
||||
coalesced_area += sf.extent;
|
||||
@@ -2169,14 +2218,14 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
add_sample_to(extents, sf.extent, extents_increment, seq);
|
||||
// search here is for LLONG_MAX, not minextent, because we are dropping features, not coalescing them,
|
||||
// so we shouldn't expect to find anything small that we can related this feature to.
|
||||
if (minextent != 0 && sf.extent + coalesced_area <= minextent && find_partial(partials, sf, which_partial, layer_unmaps, LLONG_MAX)) {
|
||||
if (minextent != 0 && sf.extent + coalesced_area <= minextent && find_partial(partials, sf, which_partial, layer_unmaps, LLONG_MAX, multiplier_seq)) {
|
||||
preserve_attributes(arg->attribute_accum, sf, stringpool, pool_off, partials[which_partial]);
|
||||
strategy->dropped_as_needed++;
|
||||
continue;
|
||||
}
|
||||
} else if (additional[A_COALESCE_SMALLEST_AS_NEEDED]) {
|
||||
add_sample_to(extents, sf.extent, extents_increment, seq);
|
||||
if (minextent != 0 && sf.extent + coalesced_area <= minextent && find_partial(partials, sf, which_partial, layer_unmaps, minextent)) {
|
||||
if (minextent != 0 && sf.extent + coalesced_area <= minextent && find_partial(partials, sf, which_partial, layer_unmaps, minextent, multiplier_seq)) {
|
||||
coalesce_geometry(partials[which_partial], sf);
|
||||
partials[which_partial].coalesced = true;
|
||||
coalesced_area += sf.extent;
|
||||
@@ -2199,7 +2248,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
}
|
||||
|
||||
fraction_accum += fraction;
|
||||
if (fraction_accum < 1 && find_partial(partials, sf, which_partial, layer_unmaps, LLONG_MAX)) {
|
||||
if (fraction_accum < 1 && find_partial(partials, sf, which_partial, layer_unmaps, LLONG_MAX, multiplier_seq)) {
|
||||
if (additional[A_COALESCE_FRACTION_AS_NEEDED]) {
|
||||
coalesce_geometry(partials[which_partial], sf);
|
||||
partials[which_partial].coalesced = true;
|
||||
@@ -2328,6 +2377,33 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
coalesced_area = 0;
|
||||
}
|
||||
|
||||
if (retain_points_multiplier > 1) {
|
||||
// mapping from input sequence to current sequence within this tile
|
||||
std::vector<std::pair<size_t, size_t>> feature_sequences;
|
||||
|
||||
for (size_t i = 0; i < partials.size(); i++) {
|
||||
feature_sequences.emplace_back(partials[i].original_seq, i);
|
||||
}
|
||||
|
||||
// tag each feature with its sequence number within the tile
|
||||
// if the tile were sorted by input order
|
||||
//
|
||||
// these will be smaller numbers, and avoid the problem of the
|
||||
// original sequence number varying based on how many reader threads
|
||||
// there were reading the input
|
||||
std::sort(feature_sequences.begin(), feature_sequences.end());
|
||||
for (size_t i = 0; i < feature_sequences.size(); i++) {
|
||||
size_t j = feature_sequences[i].second;
|
||||
|
||||
serial_val val;
|
||||
val.type = mvt_double;
|
||||
val.s = std::to_string(i);
|
||||
|
||||
partials[j].full_keys.push_back("tippecanoe:retain_points_multiplier_sequence");
|
||||
partials[j].full_values.push_back(val);
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(shared_nodes.begin(), shared_nodes.end());
|
||||
|
||||
for (size_t i = 0; i < partials.size(); i++) {
|
||||
@@ -2578,11 +2654,15 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
}
|
||||
|
||||
if (prevent[P_INPUT_ORDER]) {
|
||||
std::sort(layer_features.begin(), layer_features.end(), preservecmp);
|
||||
auto clustered = assemble_multiplier_clusters(layer_features);
|
||||
std::sort(clustered.begin(), clustered.end(), preservecmp);
|
||||
layer_features = disassemble_multiplier_clusters(clustered);
|
||||
}
|
||||
|
||||
if (order_by.size() != 0) {
|
||||
std::sort(layer_features.begin(), layer_features.end(), ordercmp);
|
||||
auto clustered = assemble_multiplier_clusters(layer_features);
|
||||
std::sort(clustered.begin(), clustered.end(), ordercmp);
|
||||
layer_features = disassemble_multiplier_clusters(clustered);
|
||||
}
|
||||
|
||||
if (z == maxzoom && limit_tile_feature_count_at_maxzoom != 0) {
|
||||
|
||||
@@ -8,18 +8,9 @@
|
||||
#include <map>
|
||||
#include "mbtiles.hpp"
|
||||
#include "serial.hpp"
|
||||
#include "attribute.hpp"
|
||||
#include "jsonpull/jsonpull.h"
|
||||
|
||||
enum attribute_op {
|
||||
op_sum,
|
||||
op_product,
|
||||
op_mean,
|
||||
op_concat,
|
||||
op_comma,
|
||||
op_max,
|
||||
op_min,
|
||||
};
|
||||
|
||||
struct atomic_strategy {
|
||||
std::atomic<size_t> dropped_by_rate;
|
||||
std::atomic<size_t> dropped_by_gamma;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#ifndef VERSION_HPP
|
||||
#define VERSION_HPP
|
||||
|
||||
#define VERSION "v2.40.0"
|
||||
#define VERSION "v2.41.2"
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user