Compare commits

...
14 changed files with 120 additions and 48 deletions
+75 -23
View File
@@ -1076,7 +1076,7 @@ bool pnpoly_mp(std::vector<mvt_geometry> const &geom, long long x, long long y)
}
std::string overzoom(std::vector<input_tile> const &tiles, int nz, int nx, int ny,
int detail, int buffer,
int detail_or_unspecified, int buffer,
std::set<std::string> const &keep,
std::set<std::string> const &exclude,
std::vector<std::string> const &exclude_prefix,
@@ -1087,7 +1087,7 @@ std::string overzoom(std::vector<input_tile> const &tiles, int nz, int nx, int n
std::vector<std::string> const &unidecode_data, double simplification,
double tiny_polygon_size,
std::vector<mvt_layer> const &bins, std::string const &bin_by_id_list,
std::string const &accumulate_numeric) {
std::string const &accumulate_numeric, size_t feature_limit) {
std::vector<source_tile> decoded;
for (auto const &t : tiles) {
@@ -1113,7 +1113,7 @@ std::string overzoom(std::vector<input_tile> const &tiles, int nz, int nx, int n
decoded.push_back(out);
}
return overzoom(decoded, nz, nx, ny, detail, buffer, keep, exclude, exclude_prefix, do_compress, next_overzoomed_tiles, demultiply, filter, preserve_input_order, attribute_accum, unidecode_data, simplification, tiny_polygon_size, bins, bin_by_id_list, accumulate_numeric);
return overzoom(decoded, nz, nx, ny, detail_or_unspecified, buffer, keep, exclude, exclude_prefix, do_compress, next_overzoomed_tiles, demultiply, filter, preserve_input_order, attribute_accum, unidecode_data, simplification, tiny_polygon_size, bins, bin_by_id_list, accumulate_numeric, feature_limit);
}
// like a minimal serial_feature, but with mvt_feature-style attributes
@@ -1284,18 +1284,54 @@ static bool should_keep(std::string const &key,
return false;
}
static void handle_closepath_from_mvt(drawvec &geom) {
// mvt geometries close polygons with a mvt_closepath operation
// tippecanoe-internal geometries close polygons with a lineto to the initial point
size_t last_open = 0;
for (size_t i = 0; i < geom.size(); i++) {
if (geom[i].op == mvt_closepath) {
geom[i] = draw(mvt_lineto, geom[last_open].x, geom[last_open].y);
} else if (geom[i].op == mvt_moveto) {
last_open = i;
}
}
}
static void feature_out(std::vector<tile_feature> const &features, mvt_layer &outlayer,
std::set<std::string> const &keep,
std::set<std::string> const &exclude,
std::vector<std::string> const &exclude_prefix,
std::unordered_map<std::string, attribute_op> const &attribute_accum,
std::string const &accumulate_numeric,
key_pool &key_pool) {
key_pool &key_pool, int buffer) {
// Add geometry to output feature
drawvec geom = features[0].geom;
if (buffer >= 0) {
int t = features[0].t;
if (t == VT_LINE) {
geom = clip_lines(geom, 32 - outlayer.detail(), buffer);
} else if (t == VT_POLYGON) {
drawvec dv;
handle_closepath_from_mvt(geom);
geom = simple_clip_poly(geom, 32 - outlayer.detail(), buffer, dv, false);
} else if (t == VT_POINT) {
geom = clip_point(geom, 32 - outlayer.detail(), buffer);
}
geom = remove_noop(geom, t, 0);
if (t == VT_POLYGON) {
geom = clean_or_clip_poly(geom, 0, 0, false, false);
geom = close_poly(geom);
}
}
mvt_feature outfeature;
outfeature.type = features[0].t;
for (auto const &g : features[0].geom) {
for (auto const &g : geom) {
outfeature.geometry.emplace_back(g.op, g.x, g.y);
}
@@ -1516,22 +1552,27 @@ static std::vector<size_t> parse_ids_string(mvt_value const &v) {
mvt_tile assign_to_bins(mvt_tile &features,
std::vector<mvt_layer> const &bins, std::string const &bin_by_id_list,
int z, int x, int y, int detail,
int z, int x, int y,
std::unordered_map<std::string, attribute_op> const &attribute_accum,
std::string const &accumulate_numeric,
std::set<std::string> keep,
std::set<std::string> exclude,
std::vector<std::string> exclude_prefix) {
std::vector<std::string> exclude_prefix,
int buffer) {
std::vector<index_event> events;
key_pool key_pool;
if (bins.size() == 0) {
return mvt_tile();
}
// Index bins
for (size_t i = 0; i < bins.size(); i++) {
for (size_t j = 0; j < bins[i].features.size(); j++) {
long long xmin, ymin, xmax, ymax;
unsigned long long start, end;
get_bbox(bins[i].features[j].geometry, &xmin, &ymin, &xmax, &ymax, z, x, y, detail);
get_bbox(bins[i].features[j].geometry, &xmin, &ymin, &xmax, &ymax, z, x, y, bins[i].detail());
get_quadkey_bounds(xmin, ymin, xmax, ymax, &start, &end);
events.emplace_back(start, index_event::ENTER, i, j, xmin, ymin, xmax, ymax);
events.emplace_back(end, index_event::EXIT, i, j, xmin, ymin, xmax, ymax);
@@ -1551,7 +1592,7 @@ mvt_tile assign_to_bins(mvt_tile &features,
fid_to_feature.emplace(features.layers[i].features[j].id, std::make_pair(i, j));
}
get_bbox(features.layers[i].features[j].geometry, &xmin, &ymin, &xmax, &ymax, z, x, y, detail);
get_bbox(features.layers[i].features[j].geometry, &xmin, &ymin, &xmax, &ymax, z, x, y, features.layers[i].detail());
get_quadkey_bounds(xmin, ymin, xmax, ymax, &start, &end);
events.emplace_back(start, index_event::CHECK, i, j, xmin, ymin, xmax, ymax);
}
@@ -1562,7 +1603,7 @@ mvt_tile assign_to_bins(mvt_tile &features,
std::set<active_bin> active;
mvt_layer outlayer;
outlayer.extent = 1 << detail;
outlayer.extent = bins[0].extent;
outlayer.version = 2;
outlayer.name = features.layers[0].name;
@@ -1680,7 +1721,7 @@ mvt_tile assign_to_bins(mvt_tile &features,
if (outfeatures[i].size() > 1) {
feature_out(outfeatures[i], outlayer,
keep, exclude, exclude_prefix, attribute_accum,
accumulate_numeric, key_pool);
accumulate_numeric, key_pool, buffer);
mvt_feature &nfeature = outlayer.features.back();
mvt_value val;
val.type = mvt_uint;
@@ -1702,7 +1743,7 @@ mvt_tile assign_to_bins(mvt_tile &features,
}
std::string overzoom(std::vector<source_tile> const &tiles, int nz, int nx, int ny,
int detail, int buffer,
int detail_or_unspecified, int buffer,
std::set<std::string> const &keep,
std::set<std::string> const &exclude,
std::vector<std::string> const &exclude_prefix,
@@ -1713,7 +1754,7 @@ std::string overzoom(std::vector<source_tile> const &tiles, int nz, int nx, int
std::vector<std::string> const &unidecode_data, double simplification,
double tiny_polygon_size,
std::vector<mvt_layer> const &bins, std::string const &bin_by_id_list,
std::string const &accumulate_numeric) {
std::string const &accumulate_numeric, size_t feature_limit) {
mvt_tile outtile;
key_pool key_pool;
@@ -1721,7 +1762,7 @@ std::string overzoom(std::vector<source_tile> const &tiles, int nz, int nx, int
for (auto const &layer : tile.tile.layers) {
mvt_layer *outlayer = NULL;
int det = detail;
int det = detail_or_unspecified;
if (det <= 0) {
det = std::round(log(layer.extent) / log(2));
}
@@ -1840,7 +1881,10 @@ std::string overzoom(std::vector<source_tile> const &tiles, int nz, int nx, int
if (flush_multiplier_cluster) {
if (pending_tile_features.size() > 0) {
feature_out(pending_tile_features, *outlayer, keep, exclude, exclude_prefix, attribute_accum, accumulate_numeric, key_pool);
feature_out(pending_tile_features, *outlayer, keep, exclude, exclude_prefix, attribute_accum, accumulate_numeric, key_pool, -1);
if (outlayer->features.size() >= feature_limit) {
break;
}
pending_tile_features.clear();
}
}
@@ -1854,16 +1898,16 @@ std::string overzoom(std::vector<source_tile> const &tiles, int nz, int nx, int
if (t == VT_POLYGON && tiny_polygon_size > 0) {
bool simplified_away_by_reduction = false;
geom = reduce_tiny_poly(geom, nz, detail, &still_need_simplification_after_reduction, &simplified_away_by_reduction, &accum_area, tiny_polygon_size);
geom = reduce_tiny_poly(geom, nz, det, &still_need_simplification_after_reduction, &simplified_away_by_reduction, &accum_area, tiny_polygon_size);
} else {
still_need_simplification_after_reduction = true;
}
if (simplification > 0 && still_need_simplification_after_reduction) {
if (t == VT_POLYGON) {
geom = simplify_lines_basic(geom, nz, detail, simplification, 4);
geom = simplify_lines_basic(geom, nz, det, simplification, 4);
} else if (t == VT_LINE) {
geom = simplify_lines_basic(geom, nz, detail, simplification, 0);
geom = simplify_lines_basic(geom, nz, det, simplification, 0);
}
}
@@ -1897,8 +1941,11 @@ std::string overzoom(std::vector<source_tile> const &tiles, int nz, int nx, int
}
if (pending_tile_features.size() > 0) {
feature_out(pending_tile_features, *outlayer, keep, exclude, exclude_prefix, attribute_accum, accumulate_numeric, key_pool);
feature_out(pending_tile_features, *outlayer, keep, exclude, exclude_prefix, attribute_accum, accumulate_numeric, key_pool, -1);
pending_tile_features.clear();
if (outlayer->features.size() >= feature_limit) {
break;
}
}
if (preserve_input_order) {
@@ -1927,10 +1974,14 @@ std::string overzoom(std::vector<source_tile> const &tiles, int nz, int nx, int
std::vector<source_tile> sts;
sts.push_back(st);
// feature_limit arg is 1, because we just care whether there are any overzoomed features
// left after clipping to the child tile, not about their actual content
std::string child = overzoom(sts,
nz + 1, nx * 2 + x, ny * 2 + y,
detail, buffer, keep, exclude, exclude_prefix, false, NULL,
demultiply, filter, preserve_input_order, attribute_accum, unidecode_data, simplification, tiny_polygon_size, bins, bin_by_id_list, accumulate_numeric);
detail_or_unspecified, buffer, keep, exclude, exclude_prefix, false, NULL,
demultiply, filter, preserve_input_order, attribute_accum, unidecode_data,
simplification, tiny_polygon_size, bins, bin_by_id_list, accumulate_numeric,
1);
if (child.size() > 0) {
next_overzoomed_tiles->emplace_back(nx * 2 + x, ny * 2 + y);
}
@@ -1940,8 +1991,9 @@ std::string overzoom(std::vector<source_tile> const &tiles, int nz, int nx, int
}
if (bins.size() > 0) {
outtile = assign_to_bins(outtile, bins, bin_by_id_list, nz, nx, ny, detail, attribute_accum, accumulate_numeric,
keep, exclude, exclude_prefix);
outtile = assign_to_bins(outtile, bins, bin_by_id_list, nz, nx, ny,
attribute_accum, accumulate_numeric,
keep, exclude, exclude_prefix, buffer);
}
for (ssize_t i = outtile.layers.size() - 1; i >= 0; i--) {
+7 -1
View File
@@ -28,6 +28,7 @@
int minzoom = 0;
int maxzoom = 32;
bool force = false;
std::set<std::string> include_attr;
bool progress_time() {
return false;
@@ -217,7 +218,7 @@ void handle(std::string message, int z, unsigned x, unsigned y, std::set<std::st
} else if (coordinate_mode == 2) { // integer
scale = 1;
}
layer_to_geojson(layer, z, x, y, !pipeline, pipeline, pipeline, false, 0, 0, 0, !force, state, scale);
layer_to_geojson(layer, z, x, y, !pipeline, pipeline, pipeline, false, 0, 0, 0, !force, state, scale, include_attr);
if (!pipeline) {
if (true) {
@@ -571,6 +572,7 @@ int main(int argc, char **argv) {
{"stats", no_argument, 0, 'S'},
{"force", no_argument, 0, 'f'},
{"exclude-metadata-row", required_argument, 0, 'x'},
{"include", required_argument, 0, 'y'},
{0, 0, 0, 0},
};
@@ -630,6 +632,10 @@ int main(int argc, char **argv) {
exclude_meta.insert(optarg);
break;
case 'y':
include_attr.insert(optarg);
break;
default:
usage(argv);
}
+2 -2
View File
@@ -127,7 +127,7 @@ std::string overzoom(std::vector<source_tile> const &tiles, int nz, int nx, int
std::vector<std::string> const &unidecode_data, double simplification,
double tiny_polygon_size,
std::vector<mvt_layer> const &bins, std::string const &bin_by_id_list,
std::string const &accumulate_numeric);
std::string const &accumulate_numeric, size_t feature_limit);
std::string overzoom(std::vector<input_tile> const &tiles, int nz, int nx, int ny,
int detail, int buffer,
@@ -141,7 +141,7 @@ std::string overzoom(std::vector<input_tile> const &tiles, int nz, int nx, int n
std::vector<std::string> const &unidecode_data, double simplification,
double tiny_polygon_size,
std::vector<mvt_layer> const &bins, std::string const &bin_by_id_list,
std::string const &accumulate_numeric);
std::string const &accumulate_numeric, size_t feature_limit);
draw center_of_mass_mp(const drawvec &dv);
+5
View File
@@ -9,6 +9,7 @@
#include <vector>
#include <optional>
#include <memory>
#include <cmath>
#include "errors.hpp"
#include "text.hpp"
@@ -201,6 +202,10 @@ struct mvt_layer {
// For tracking the key-value constants already used in this layer
std::vector<ssize_t> key_dedup = std::vector<ssize_t>(65536, -1);
std::vector<ssize_t> value_dedup = std::vector<ssize_t>(65536, -1);
int detail() const {
return std::round(std::log(extent) / std::log(2));
}
};
struct mvt_tile {
+6 -2
View File
@@ -221,7 +221,11 @@ int main(int argc, char **argv) {
exit(EXIT_OPEN);
}
bins = parse_layers(f, nz, nx, ny, 1LL << detail, true);
int det = detail;
if (det < 0) {
det = 12;
}
bins = parse_layers(f, nz, nx, ny, 1LL << det, true);
fclose(f);
}
@@ -251,7 +255,7 @@ int main(int argc, char **argv) {
its.push_back(std::move(t));
}
std::string out = overzoom(its, nz, nx, ny, detail, buffer, keep, exclude, exclude_prefix, true, NULL, demultiply, json_filter, preserve_input_order, attribute_accum, unidecode_data, simplification, tiny_polygon_size, bins, bin_by_id_list, accumulate_numeric);
std::string out = overzoom(its, nz, nx, ny, detail, buffer, keep, exclude, exclude_prefix, true, NULL, demultiply, json_filter, preserve_input_order, attribute_accum, unidecode_data, simplification, tiny_polygon_size, bins, bin_by_id_list, accumulate_numeric, SIZE_MAX);
FILE *f = fopen(outfile, "wb");
if (f == NULL) {
+1 -1
View File
@@ -55,7 +55,7 @@ void *run_writer(void *a) {
json_writer state(fp);
for (size_t i = 0; i < wa->layers->size(); i++) {
layer_to_geojson((*(wa->layers))[i], wa->z, wa->x, wa->y, false, true, false, true, 0, 0, 0, true, state, 0);
layer_to_geojson((*(wa->layers))[i], wa->z, wa->x, wa->y, false, true, false, true, 0, 0, 0, true, state, 0, std::set<std::string>());
}
if (fclose(fp) != 0) {
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+4 -4
View File
@@ -1,12 +1,12 @@
{ "type": "FeatureCollection", "properties": { "zoom": 11, "x": 327, "y": 791 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "muni", "version": 2, "extent": 4096 }, "features": [
{ "type": "Feature", "properties": { "ZCTA5CE10": "94132", "GEOID10": "94132", "CLASSFP10": "B5", "MTFCC10": "G6350", "FUNCSTAT10": "S", "ALAND10": 8078894, "AWATER10": 1299131, "INTPTLAT10": "+37.7222142", "INTPTLON10": "-122.4840831", "tippecanoe:count": 163 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -122.490005, 37.738006 ], [ -122.488461, 37.737055 ], [ -122.486229, 37.736784 ], [ -122.483311, 37.737463 ], [ -122.482452, 37.737463 ], [ -122.481766, 37.737191 ], [ -122.475414, 37.737463 ], [ -122.475243, 37.734612 ], [ -122.475071, 37.734747 ], [ -122.471638, 37.734747 ], [ -122.471981, 37.731082 ], [ -122.472153, 37.731082 ], [ -122.472496, 37.721578 ], [ -122.464428, 37.721713 ], [ -122.463913, 37.722392 ], [ -122.462196, 37.723071 ], [ -122.462196, 37.721713 ], [ -122.462711, 37.721713 ], [ -122.462711, 37.718590 ], [ -122.462540, 37.711257 ], [ -122.460823, 37.710578 ], [ -122.464256, 37.710578 ], [ -122.465973, 37.710171 ], [ -122.467690, 37.709220 ], [ -122.468891, 37.708270 ], [ -122.497730, 37.708134 ], [ -122.498245, 37.708134 ], [ -122.498245, 37.710714 ], [ -122.498417, 37.714924 ], [ -122.498760, 37.715875 ], [ -122.499962, 37.717504 ], [ -122.500305, 37.718590 ], [ -122.500477, 37.720627 ], [ -122.502708, 37.723343 ], [ -122.503052, 37.724022 ], [ -122.503052, 37.725244 ], [ -122.503567, 37.725379 ], [ -122.505283, 37.726330 ], [ -122.506313, 37.727416 ], [ -122.507172, 37.732575 ], [ -122.506828, 37.735426 ], [ -122.505283, 37.735426 ], [ -122.505283, 37.735562 ], [ -122.502022, 37.735562 ], [ -122.500477, 37.735155 ], [ -122.498589, 37.734204 ], [ -122.496872, 37.733933 ], [ -122.491379, 37.734069 ], [ -122.491379, 37.737327 ], [ -122.490349, 37.737870 ], [ -122.490005, 37.738006 ] ] ] } }
{ "type": "Feature", "properties": { "ZCTA5CE10": "94132", "GEOID10": "94132", "CLASSFP10": "B5", "MTFCC10": "G6350", "FUNCSTAT10": "S", "ALAND10": 8078894, "AWATER10": 1299131, "INTPTLAT10": "+37.7222142", "INTPTLON10": "-122.4840831", "tippecanoe:count": 163 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -122.490005, 37.738006 ], [ -122.488461, 37.737055 ], [ -122.486229, 37.736784 ], [ -122.483311, 37.737463 ], [ -122.482452, 37.737463 ], [ -122.481766, 37.737191 ], [ -122.475414, 37.737463 ], [ -122.475243, 37.734612 ], [ -122.475071, 37.734747 ], [ -122.471638, 37.734747 ], [ -122.471981, 37.731082 ], [ -122.472153, 37.731082 ], [ -122.472496, 37.721578 ], [ -122.464428, 37.721713 ], [ -122.463913, 37.722392 ], [ -122.462196, 37.723071 ], [ -122.462196, 37.721713 ], [ -122.462711, 37.721713 ], [ -122.462711, 37.718590 ], [ -122.462668, 37.715875 ], [ -122.498760, 37.715875 ], [ -122.499962, 37.717504 ], [ -122.500305, 37.718590 ], [ -122.500477, 37.720627 ], [ -122.502708, 37.723343 ], [ -122.503052, 37.724022 ], [ -122.503052, 37.725244 ], [ -122.503567, 37.725379 ], [ -122.505283, 37.726330 ], [ -122.506313, 37.727416 ], [ -122.507172, 37.732575 ], [ -122.506828, 37.735426 ], [ -122.505283, 37.735426 ], [ -122.505283, 37.735562 ], [ -122.502022, 37.735562 ], [ -122.500477, 37.735155 ], [ -122.498589, 37.734204 ], [ -122.496872, 37.733933 ], [ -122.491379, 37.734069 ], [ -122.491379, 37.737327 ], [ -122.490349, 37.737870 ], [ -122.490005, 37.738006 ] ] ] } }
,
{ "type": "Feature", "properties": { "ZCTA5CE10": "94112", "GEOID10": "94112", "CLASSFP10": "B5", "MTFCC10": "G6350", "FUNCSTAT10": "S", "ALAND10": 8720166, "AWATER10": 0, "INTPTLAT10": "+37.7203669", "INTPTLON10": "-122.4429361", "tippecanoe:count": 259 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -122.426662, 37.736376 ], [ -122.426491, 37.736241 ], [ -122.427349, 37.735698 ], [ -122.424946, 37.735562 ], [ -122.423916, 37.734612 ], [ -122.422886, 37.734340 ], [ -122.422199, 37.735155 ], [ -122.421856, 37.735155 ], [ -122.421856, 37.734612 ], [ -122.420139, 37.732983 ], [ -122.418251, 37.732983 ], [ -122.418938, 37.732847 ], [ -122.418938, 37.732168 ], [ -122.415161, 37.732168 ], [ -122.421684, 37.731761 ], [ -122.421684, 37.731082 ], [ -122.420139, 37.731489 ], [ -122.420483, 37.728910 ], [ -122.423744, 37.728774 ], [ -122.423058, 37.727280 ], [ -122.424088, 37.725923 ], [ -122.423573, 37.725651 ], [ -122.422886, 37.723886 ], [ -122.423744, 37.723750 ], [ -122.424774, 37.722121 ], [ -122.424603, 37.721713 ], [ -122.426319, 37.718590 ], [ -122.427349, 37.715060 ], [ -122.425632, 37.714517 ], [ -122.426662, 37.711257 ], [ -122.427177, 37.711257 ], [ -122.426147, 37.710986 ], [ -122.426662, 37.710171 ], [ -122.429924, 37.711529 ], [ -122.430096, 37.710850 ], [ -122.429237, 37.709628 ], [ -122.428379, 37.709220 ], [ -122.428379, 37.708405 ], [ -122.434044, 37.708134 ], [ -122.440395, 37.708405 ], [ -122.452240, 37.708134 ], [ -122.468891, 37.708270 ], [ -122.467690, 37.709220 ], [ -122.465973, 37.710171 ], [ -122.464256, 37.710578 ], [ -122.460823, 37.710578 ], [ -122.462540, 37.711257 ], [ -122.462711, 37.718590 ], [ -122.462711, 37.721713 ], [ -122.462196, 37.721713 ], [ -122.462196, 37.725244 ], [ -122.462711, 37.725515 ], [ -122.462540, 37.727145 ], [ -122.462025, 37.727416 ], [ -122.460823, 37.727552 ], [ -122.460995, 37.728638 ], [ -122.459965, 37.728774 ], [ -122.459965, 37.729860 ], [ -122.459278, 37.730810 ], [ -122.457390, 37.730675 ], [ -122.457561, 37.731082 ], [ -122.453442, 37.731625 ], [ -122.453442, 37.730675 ], [ -122.444344, 37.730675 ], [ -122.444344, 37.728231 ], [ -122.443657, 37.728366 ], [ -122.439537, 37.730131 ], [ -122.435932, 37.731625 ], [ -122.435074, 37.731489 ], [ -122.432156, 37.732983 ], [ -122.431984, 37.732983 ], [ -122.432327, 37.733254 ], [ -122.428551, 37.735019 ], [ -122.426662, 37.736376 ] ] ] } }
{ "type": "Feature", "properties": { "ZCTA5CE10": "94112", "GEOID10": "94112", "CLASSFP10": "B5", "MTFCC10": "G6350", "FUNCSTAT10": "S", "ALAND10": 8720166, "AWATER10": 0, "INTPTLAT10": "+37.7203669", "INTPTLON10": "-122.4429361", "tippecanoe:count": 259 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -122.426662, 37.736376 ], [ -122.426491, 37.736241 ], [ -122.427349, 37.735698 ], [ -122.424946, 37.735562 ], [ -122.423916, 37.734612 ], [ -122.422886, 37.734340 ], [ -122.422199, 37.735155 ], [ -122.421856, 37.735155 ], [ -122.421856, 37.734612 ], [ -122.420139, 37.732983 ], [ -122.418251, 37.732983 ], [ -122.418938, 37.732847 ], [ -122.418938, 37.732168 ], [ -122.415161, 37.732168 ], [ -122.421684, 37.731761 ], [ -122.421684, 37.731082 ], [ -122.420139, 37.731489 ], [ -122.420483, 37.728910 ], [ -122.423744, 37.728774 ], [ -122.423058, 37.727280 ], [ -122.424088, 37.725923 ], [ -122.423573, 37.725651 ], [ -122.422886, 37.723886 ], [ -122.423744, 37.723750 ], [ -122.424774, 37.722121 ], [ -122.424603, 37.721713 ], [ -122.426319, 37.718590 ], [ -122.427092, 37.715875 ], [ -122.462668, 37.715875 ], [ -122.462711, 37.718590 ], [ -122.462711, 37.721713 ], [ -122.462196, 37.721713 ], [ -122.462196, 37.725244 ], [ -122.462711, 37.725515 ], [ -122.462540, 37.727145 ], [ -122.462025, 37.727416 ], [ -122.460823, 37.727552 ], [ -122.460995, 37.728638 ], [ -122.459965, 37.728774 ], [ -122.459965, 37.729860 ], [ -122.459278, 37.730810 ], [ -122.457390, 37.730675 ], [ -122.457561, 37.731082 ], [ -122.453442, 37.731625 ], [ -122.453442, 37.730675 ], [ -122.444344, 37.730675 ], [ -122.444344, 37.728231 ], [ -122.443657, 37.728366 ], [ -122.439537, 37.730131 ], [ -122.435932, 37.731625 ], [ -122.435074, 37.731489 ], [ -122.432156, 37.732983 ], [ -122.431984, 37.732983 ], [ -122.432327, 37.733254 ], [ -122.428551, 37.735019 ], [ -122.426662, 37.736376 ] ] ] } }
,
{ "type": "Feature", "properties": { "ZCTA5CE10": "94134", "GEOID10": "94134", "CLASSFP10": "B5", "MTFCC10": "G6350", "FUNCSTAT10": "S", "ALAND10": 6210550, "AWATER10": 90877, "INTPTLAT10": "+37.7210461", "INTPTLON10": "-122.4135554", "tippecanoe:count": 124 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -122.406921, 37.738006 ], [ -122.406578, 37.735698 ], [ -122.405033, 37.733661 ], [ -122.402802, 37.729317 ], [ -122.398853, 37.718590 ], [ -122.397995, 37.715467 ], [ -122.398510, 37.715467 ], [ -122.396450, 37.712887 ], [ -122.395763, 37.710850 ], [ -122.394047, 37.711257 ], [ -122.390785, 37.711122 ], [ -122.390957, 37.710307 ], [ -122.393703, 37.708270 ], [ -122.423744, 37.708270 ], [ -122.428379, 37.708405 ], [ -122.428379, 37.709220 ], [ -122.429237, 37.709628 ], [ -122.430096, 37.710850 ], [ -122.429924, 37.711529 ], [ -122.426662, 37.710171 ], [ -122.426147, 37.710986 ], [ -122.427177, 37.711257 ], [ -122.426662, 37.711257 ], [ -122.425632, 37.714517 ], [ -122.427349, 37.715060 ], [ -122.426319, 37.718590 ], [ -122.424603, 37.721713 ], [ -122.424774, 37.722121 ], [ -122.423744, 37.723750 ], [ -122.422886, 37.723886 ], [ -122.423573, 37.725651 ], [ -122.424088, 37.725923 ], [ -122.423058, 37.727280 ], [ -122.423744, 37.728774 ], [ -122.420483, 37.728910 ], [ -122.420139, 37.731489 ], [ -122.421684, 37.731082 ], [ -122.421684, 37.731761 ], [ -122.419453, 37.732032 ], [ -122.416019, 37.732032 ], [ -122.414474, 37.732439 ], [ -122.409496, 37.735019 ], [ -122.408466, 37.736241 ], [ -122.408295, 37.737598 ], [ -122.406921, 37.738006 ] ] ] } }
{ "type": "Feature", "properties": { "ZCTA5CE10": "94134", "GEOID10": "94134", "CLASSFP10": "B5", "MTFCC10": "G6350", "FUNCSTAT10": "S", "ALAND10": 6210550, "AWATER10": 90877, "INTPTLAT10": "+37.7210461", "INTPTLON10": "-122.4135554", "tippecanoe:count": 124 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -122.406921, 37.738006 ], [ -122.406578, 37.735698 ], [ -122.405033, 37.733661 ], [ -122.402802, 37.729317 ], [ -122.398853, 37.718590 ], [ -122.398124, 37.715875 ], [ -122.427092, 37.715875 ], [ -122.426319, 37.718590 ], [ -122.424603, 37.721713 ], [ -122.424774, 37.722121 ], [ -122.423744, 37.723750 ], [ -122.422886, 37.723886 ], [ -122.423573, 37.725651 ], [ -122.424088, 37.725923 ], [ -122.423058, 37.727280 ], [ -122.423744, 37.728774 ], [ -122.420483, 37.728910 ], [ -122.420139, 37.731489 ], [ -122.421684, 37.731082 ], [ -122.421684, 37.731761 ], [ -122.419453, 37.732032 ], [ -122.416019, 37.732032 ], [ -122.414474, 37.732439 ], [ -122.409496, 37.735019 ], [ -122.408466, 37.736241 ], [ -122.408295, 37.737598 ], [ -122.406921, 37.738006 ] ] ] } }
,
{ "type": "Feature", "properties": { "ZCTA5CE10": "94124", "GEOID10": "94124", "CLASSFP10": "B5", "MTFCC10": "G6350", "FUNCSTAT10": "S", "ALAND10": 12765980, "AWATER10": 2804039, "INTPTLAT10": "+37.7288947", "INTPTLON10": "-122.3827787", "tippecanoe:count": 314 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -122.377911, 37.753615 ], [ -122.376022, 37.752530 ], [ -122.373104, 37.746015 ], [ -122.367611, 37.740178 ], [ -122.368298, 37.739770 ], [ -122.373447, 37.739635 ], [ -122.373962, 37.739499 ], [ -122.373447, 37.738684 ], [ -122.372761, 37.738277 ], [ -122.367439, 37.738277 ], [ -122.370701, 37.737327 ], [ -122.371216, 37.737055 ], [ -122.372932, 37.737055 ], [ -122.373619, 37.737191 ], [ -122.375679, 37.738413 ], [ -122.376366, 37.738413 ], [ -122.376537, 37.738277 ], [ -122.376022, 37.738006 ], [ -122.375164, 37.737870 ], [ -122.374821, 37.737327 ], [ -122.375164, 37.736241 ], [ -122.376022, 37.735833 ], [ -122.375851, 37.735019 ], [ -122.375336, 37.735426 ], [ -122.374821, 37.734883 ], [ -122.375164, 37.734612 ], [ -122.374821, 37.734476 ], [ -122.374992, 37.733933 ], [ -122.375679, 37.732711 ], [ -122.375164, 37.732983 ], [ -122.374992, 37.732711 ], [ -122.374649, 37.732847 ], [ -122.374821, 37.732575 ], [ -122.374134, 37.732575 ], [ -122.373447, 37.732983 ], [ -122.372589, 37.733933 ], [ -122.371902, 37.734204 ], [ -122.369671, 37.732304 ], [ -122.367096, 37.735426 ], [ -122.367439, 37.735426 ], [ -122.367096, 37.735562 ], [ -122.366753, 37.735426 ], [ -122.366924, 37.734883 ], [ -122.369499, 37.732439 ], [ -122.369499, 37.732168 ], [ -122.368813, 37.731896 ], [ -122.368641, 37.732304 ], [ -122.368298, 37.732304 ], [ -122.367439, 37.731896 ], [ -122.366753, 37.732168 ], [ -122.365208, 37.733797 ], [ -122.366581, 37.732168 ], [ -122.365379, 37.732983 ], [ -122.366238, 37.731896 ], [ -122.366066, 37.731896 ], [ -122.365036, 37.732847 ], [ -122.365723, 37.731761 ], [ -122.365723, 37.731625 ], [ -122.364864, 37.732575 ], [ -122.365036, 37.732032 ], [ -122.363663, 37.731218 ], [ -122.362804, 37.732168 ], [ -122.362633, 37.732032 ], [ -122.363319, 37.731082 ], [ -122.362804, 37.730810 ], [ -122.362118, 37.731625 ], [ -122.361774, 37.731489 ], [ -122.362633, 37.730675 ], [ -122.361946, 37.730131 ], [ -122.360916, 37.729860 ], [ -122.360744, 37.730267 ], [ -122.359886, 37.730267 ], [ -122.358856, 37.729724 ], [ -122.359028, 37.729453 ], [ -122.361946, 37.728774 ], [ -122.362289, 37.728502 ], [ -122.361431, 37.728502 ], [ -122.357655, 37.729453 ], [ -122.357483, 37.729181 ], [ -122.357826, 37.728910 ], [ -122.360401, 37.728231 ], [ -122.359886, 37.728095 ], [ -122.357140, 37.728774 ], [ -122.356968, 37.728774 ], [ -122.357140, 37.727959 ], [ -122.356796, 37.727959 ], [ -122.358170, 37.718590 ], [ -122.358513, 37.715875 ], [ -122.360401, 37.708270 ], [ -122.381001, 37.708405 ], [ -122.393703, 37.708270 ], [ -122.390957, 37.710307 ], [ -122.390785, 37.711122 ], [ -122.394047, 37.711257 ], [ -122.395763, 37.710850 ], [ -122.396450, 37.712887 ], [ -122.398510, 37.715467 ], [ -122.397995, 37.715467 ], [ -122.398853, 37.718590 ], [ -122.402802, 37.729317 ], [ -122.405033, 37.733661 ], [ -122.406578, 37.735698 ], [ -122.406921, 37.738006 ], [ -122.407780, 37.737734 ], [ -122.407951, 37.737870 ], [ -122.407951, 37.739227 ], [ -122.407436, 37.741399 ], [ -122.405891, 37.743435 ], [ -122.406235, 37.743571 ], [ -122.405376, 37.744521 ], [ -122.405205, 37.744386 ], [ -122.404003, 37.748322 ], [ -122.405033, 37.749136 ], [ -122.402973, 37.749544 ], [ -122.402115, 37.749408 ], [ -122.395248, 37.749815 ], [ -122.395248, 37.751308 ], [ -122.393188, 37.751444 ], [ -122.393188, 37.749951 ], [ -122.386494, 37.750358 ], [ -122.386837, 37.752937 ], [ -122.381001, 37.753208 ], [ -122.377911, 37.753615 ] ] ] } }
{ "type": "Feature", "properties": { "ZCTA5CE10": "94124", "GEOID10": "94124", "CLASSFP10": "B5", "MTFCC10": "G6350", "FUNCSTAT10": "S", "ALAND10": 12765980, "AWATER10": 2804039, "INTPTLAT10": "+37.7288947", "INTPTLON10": "-122.3827787", "tippecanoe:count": 314 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -122.377911, 37.753615 ], [ -122.376022, 37.752530 ], [ -122.373104, 37.746015 ], [ -122.367611, 37.740178 ], [ -122.368298, 37.739770 ], [ -122.373447, 37.739635 ], [ -122.373962, 37.739499 ], [ -122.373447, 37.738684 ], [ -122.372761, 37.738277 ], [ -122.367439, 37.738277 ], [ -122.370701, 37.737327 ], [ -122.371216, 37.737055 ], [ -122.372932, 37.737055 ], [ -122.373619, 37.737191 ], [ -122.375679, 37.738413 ], [ -122.376366, 37.738413 ], [ -122.376537, 37.738277 ], [ -122.376022, 37.738006 ], [ -122.375164, 37.737870 ], [ -122.374821, 37.737327 ], [ -122.375164, 37.736241 ], [ -122.376022, 37.735833 ], [ -122.375851, 37.735019 ], [ -122.375336, 37.735426 ], [ -122.374821, 37.734883 ], [ -122.375164, 37.734612 ], [ -122.374821, 37.734476 ], [ -122.374992, 37.733933 ], [ -122.375679, 37.732711 ], [ -122.375164, 37.732983 ], [ -122.374992, 37.732711 ], [ -122.374649, 37.732847 ], [ -122.374821, 37.732575 ], [ -122.374134, 37.732575 ], [ -122.373447, 37.732983 ], [ -122.372589, 37.733933 ], [ -122.371902, 37.734204 ], [ -122.369671, 37.732304 ], [ -122.367096, 37.735426 ], [ -122.367439, 37.735426 ], [ -122.367096, 37.735562 ], [ -122.366753, 37.735426 ], [ -122.366924, 37.734883 ], [ -122.369499, 37.732439 ], [ -122.369499, 37.732168 ], [ -122.368813, 37.731896 ], [ -122.368641, 37.732304 ], [ -122.368298, 37.732304 ], [ -122.367439, 37.731896 ], [ -122.366753, 37.732168 ], [ -122.365208, 37.733797 ], [ -122.366581, 37.732168 ], [ -122.365379, 37.732983 ], [ -122.366238, 37.731896 ], [ -122.366066, 37.731896 ], [ -122.365036, 37.732847 ], [ -122.365723, 37.731761 ], [ -122.365723, 37.731625 ], [ -122.364864, 37.732575 ], [ -122.365036, 37.732032 ], [ -122.363663, 37.731218 ], [ -122.362804, 37.732168 ], [ -122.362633, 37.732032 ], [ -122.363319, 37.731082 ], [ -122.362804, 37.730810 ], [ -122.362118, 37.731625 ], [ -122.361774, 37.731489 ], [ -122.362633, 37.730675 ], [ -122.361946, 37.730131 ], [ -122.360916, 37.729860 ], [ -122.360744, 37.730267 ], [ -122.359886, 37.730267 ], [ -122.358856, 37.729724 ], [ -122.359028, 37.729453 ], [ -122.361946, 37.728774 ], [ -122.362289, 37.728502 ], [ -122.361431, 37.728502 ], [ -122.357655, 37.729453 ], [ -122.357483, 37.729181 ], [ -122.357826, 37.728910 ], [ -122.360401, 37.728231 ], [ -122.359886, 37.728095 ], [ -122.357140, 37.728774 ], [ -122.356968, 37.728774 ], [ -122.357140, 37.727959 ], [ -122.356796, 37.727959 ], [ -122.358170, 37.718590 ], [ -122.358513, 37.715875 ], [ -122.398124, 37.715875 ], [ -122.398853, 37.718590 ], [ -122.402802, 37.729317 ], [ -122.405033, 37.733661 ], [ -122.406578, 37.735698 ], [ -122.406921, 37.738006 ], [ -122.407780, 37.737734 ], [ -122.407951, 37.737870 ], [ -122.407951, 37.739227 ], [ -122.407436, 37.741399 ], [ -122.405891, 37.743435 ], [ -122.406235, 37.743571 ], [ -122.405376, 37.744521 ], [ -122.405205, 37.744386 ], [ -122.404003, 37.748322 ], [ -122.405033, 37.749136 ], [ -122.402973, 37.749544 ], [ -122.402115, 37.749408 ], [ -122.395248, 37.749815 ], [ -122.395248, 37.751308 ], [ -122.393188, 37.751444 ], [ -122.393188, 37.749951 ], [ -122.386494, 37.750358 ], [ -122.386837, 37.752937 ], [ -122.381001, 37.753208 ], [ -122.377911, 37.753615 ] ] ] } }
,
{ "type": "Feature", "properties": { "bin-ids": "236,237,510,514", "ZCTA5CE10": "94129", "GEOID10": "94129", "CLASSFP10": "B5", "MTFCC10": "G6350", "FUNCSTAT10": "S", "ALAND10": 5968455, "AWATER10": 14697, "INTPTLAT10": "+37.7973402", "INTPTLON10": "-122.4644664", "tippecanoe:count": 70 }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -122.477818, 37.811005 ], [ -122.476444, 37.810869 ], [ -122.476101, 37.809648 ], [ -122.474728, 37.809241 ], [ -122.472668, 37.808970 ], [ -122.470608, 37.808563 ], [ -122.469234, 37.807750 ], [ -122.468719, 37.807071 ], [ -122.468376, 37.806800 ], [ -122.468204, 37.806936 ], [ -122.468204, 37.806665 ], [ -122.466660, 37.805851 ], [ -122.463570, 37.804901 ], [ -122.461681, 37.804901 ], [ -122.458420, 37.805444 ], [ -122.454472, 37.806529 ], [ -122.452412, 37.806258 ], [ -122.448120, 37.806936 ], [ -122.448120, 37.806393 ], [ -122.448463, 37.806122 ], [ -122.448292, 37.804766 ], [ -122.451553, 37.803409 ], [ -122.450180, 37.802867 ], [ -122.450008, 37.802460 ], [ -122.447605, 37.800697 ], [ -122.447262, 37.798527 ], [ -122.448120, 37.798255 ], [ -122.448292, 37.797848 ], [ -122.447948, 37.797441 ], [ -122.448635, 37.797441 ], [ -122.448635, 37.797034 ], [ -122.447948, 37.796899 ], [ -122.447948, 37.796492 ], [ -122.448978, 37.796356 ], [ -122.447433, 37.795814 ], [ -122.447433, 37.795542 ], [ -122.447777, 37.795407 ], [ -122.448635, 37.795542 ], [ -122.448978, 37.795000 ], [ -122.448635, 37.794728 ], [ -122.447948, 37.793101 ], [ -122.448463, 37.792829 ], [ -122.448635, 37.791880 ], [ -122.470951, 37.787267 ], [ -122.473354, 37.787132 ], [ -122.475586, 37.786725 ], [ -122.479877, 37.786860 ], [ -122.483826, 37.787674 ], [ -122.484512, 37.789167 ], [ -122.483997, 37.789709 ], [ -122.484341, 37.790116 ], [ -122.484341, 37.789709 ], [ -122.485027, 37.789574 ], [ -122.485886, 37.790795 ], [ -122.483654, 37.794050 ], [ -122.482109, 37.798527 ], [ -122.481766, 37.798527 ], [ -122.481937, 37.798798 ], [ -122.481594, 37.798798 ], [ -122.481766, 37.798933 ], [ -122.480221, 37.801375 ], [ -122.479877, 37.802867 ], [ -122.478676, 37.805444 ], [ -122.478333, 37.808156 ], [ -122.477818, 37.808428 ], [ -122.477989, 37.810598 ], [ -122.477646, 37.810598 ], [ -122.477818, 37.811005 ] ], [ [ -122.452583, 37.803274 ], [ -122.452412, 37.803138 ], [ -122.450008, 37.802460 ], [ -122.451210, 37.803138 ], [ -122.452583, 37.803274 ] ] ], [ [ [ -122.466145, 37.806393 ], [ -122.465973, 37.806258 ], [ -122.466660, 37.805851 ], [ -122.466145, 37.806393 ] ] ], [ [ [ -122.469921, 37.809377 ], [ -122.469406, 37.809106 ], [ -122.470093, 37.809241 ], [ -122.469921, 37.809377 ] ] ] ] } }
,
+1 -1
View File
@@ -716,7 +716,7 @@ struct tileset_reader {
std::set<std::string>(), std::set<std::string>(), std::vector<std::string>(),
false, &next_overzoomed_tiles, false, NULL, false,
std::unordered_map<std::string, attribute_op>(), unidecode_data, 0, 0,
std::vector<mvt_layer>(), "", "");
std::vector<mvt_layer>(), "", "", SIZE_MAX);
return ret;
}
+1 -1
View File
@@ -1358,7 +1358,7 @@ void *run_prefilter(void *v) {
decode_meta(sf, tmp_layer, tmp_feature);
tmp_layer.features.push_back(tmp_feature);
layer_to_geojson(tmp_layer, 0, 0, 0, false, true, false, true, sf.index, sf.seq, sf.extent, true, state, 0);
layer_to_geojson(tmp_layer, 0, 0, 0, false, true, false, true, sf.index, sf.seq, sf.extent, true, state, 0, std::set<std::string>());
}
if (fclose(rpa->prefilter_fp) != 0) {
+5 -1
View File
@@ -268,7 +268,7 @@ void write_coords(json_writer &state, lonlat const &ll, double scale) {
}
}
void layer_to_geojson(mvt_layer const &layer, unsigned z, unsigned x, unsigned y, bool comma, bool name, bool zoom, bool write_dropped, unsigned long long index, long long sequence, long long extent, bool complain, json_writer &state, double scale) {
void layer_to_geojson(mvt_layer const &layer, unsigned z, unsigned x, unsigned y, bool comma, bool name, bool zoom, bool write_dropped, unsigned long long index, long long sequence, long long extent, bool complain, json_writer &state, double scale, std::set<std::string> const &include_attr) {
for (size_t f = 0; f < layer.features.size(); f++) {
mvt_feature const &feat = layer.features[f];
@@ -334,6 +334,10 @@ void layer_to_geojson(mvt_layer const &layer, unsigned z, unsigned x, unsigned y
exit(EXIT_IMPOSSIBLE);
}
if (include_attr.size() > 0 && include_attr.find(layer.keys[feat.tags[t]]) == include_attr.end()) {
continue;
}
const char *key = layer.keys[feat.tags[t]].c_str();
mvt_value const &val = layer.values[feat.tags[t + 1]];
+2 -1
View File
@@ -4,6 +4,7 @@
#include <string>
#include <vector>
#include <stdio.h>
#include <set>
enum json_write_tok {
JSON_WRITE_HASH,
@@ -61,7 +62,7 @@ struct json_writer {
void adds(std::string const &s);
};
void layer_to_geojson(mvt_layer const &layer, unsigned z, unsigned x, unsigned y, bool comma, bool name, bool zoom, bool dropped, unsigned long long index, long long sequence, long long extent, bool complain, json_writer &state, double scale);
void layer_to_geojson(mvt_layer const &layer, unsigned z, unsigned x, unsigned y, bool comma, bool name, bool zoom, bool dropped, unsigned long long index, long long sequence, long long extent, bool complain, json_writer &state, double scale, std::set<std::string> const &include_attr);
void fprintq(FILE *f, const char *s);
#endif