mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-03-24 21:05:16 +00:00
Credit dangling clustered count at the end of a tile to the last feature
This commit is contained in:
parent
b03dabe098
commit
6524b6510e
@ -256,7 +256,7 @@ tippecanoe -z5 -o filtered.mbtiles -j '{ "ne_10m_admin_0_countries": [ "all", [
|
||||
### Setting or disabling tile size limits
|
||||
|
||||
* `-M` _bytes_ or `--maximum-tile-bytes=`_bytes_: Use the specified number of _bytes_ as the maximum compressed tile size instead of 500K.
|
||||
* `-O` _features_ or `--maximum-tile-featuress=`_features_: Use the specified number of _features_ as the maximum in a tile instead of 200,000.
|
||||
* `-O` _features_ or `--maximum-tile-features=`_features_: Use the specified number of _features_ as the maximum in a tile instead of 200,000.
|
||||
* `-pf` or `--no-feature-limit`: Don't limit tiles to 200,000 features
|
||||
* `-pk` or `--no-tile-size-limit`: Don't limit tiles to 500K bytes
|
||||
* `-pC` or `--no-tile-compression`: Don't compress the PBF vector tile data.
|
||||
|
@ -310,7 +310,7 @@ the line or polygon within one tile unit of its proper location. You can probabl
|
||||
.IP \(bu 2
|
||||
\fB\fC\-M\fR \fIbytes\fP or \fB\fC\-\-maximum\-tile\-bytes=\fR\fIbytes\fP: Use the specified number of \fIbytes\fP as the maximum compressed tile size instead of 500K.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-O\fR \fIfeatures\fP or \fB\fC\-\-maximum\-tile\-featuress=\fR\fIfeatures\fP: Use the specified number of \fIfeatures\fP as the maximum in a tile instead of 200,000.
|
||||
\fB\fC\-O\fR \fIfeatures\fP or \fB\fC\-\-maximum\-tile\-features=\fR\fIfeatures\fP: Use the specified number of \fIfeatures\fP as the maximum in a tile instead of 200,000.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-pf\fR or \fB\fC\-\-no\-feature\-limit\fR: Don't limit tiles to 200,000 features
|
||||
.IP \(bu 2
|
||||
|
@ -14,7 +14,7 @@
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "muni", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "name": "Fort Cronkhite Parking Lot" }, "geometry": { "type": "Point", "coordinates": [ -122.538671, 37.832395 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "FIELD RD/Nike Site" }, "geometry": { "type": "Point", "coordinates": [ -122.527685, 37.829074 ] } }
|
||||
{ "type": "Feature", "properties": { "name": "FIELD RD/Nike Site", "clustered": true, "point_count": 2 }, "geometry": { "type": "Point", "coordinates": [ -122.527685, 37.829074 ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@ -56,7 +56,7 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "Delta St & Wilde Ave", "clustered": true, "point_count": 8 }, "geometry": { "type": "Point", "coordinates": [ -122.407479, 37.717776 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "Blanken Ave & Nueva Ave", "clustered": true, "point_count": 13 }, "geometry": { "type": "Point", "coordinates": [ -122.397480, 37.711223 ] } }
|
||||
{ "type": "Feature", "properties": { "name": "Blanken Ave & Nueva Ave", "clustered": true, "point_count": 15 }, "geometry": { "type": "Point", "coordinates": [ -122.397480, 37.711223 ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@ -246,7 +246,7 @@
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 11, "x": 954, "y": 791 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "muni", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE" }, "geometry": { "type": "Point", "coordinates": [ -12.240014, 37.820023 ] } }
|
||||
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "clustered": true, "point_count": 2 }, "geometry": { "type": "Point", "coordinates": [ -12.240014, 37.820023 ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@ -256,7 +256,7 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "BUNKER RD/Miwok Trail", "clustered": true, "point_count": 2 }, "geometry": { "type": "Point", "coordinates": [ -122.527256, 37.832599 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "FIELD RD/Nike Site" }, "geometry": { "type": "Point", "coordinates": [ -122.527685, 37.829074 ] } }
|
||||
{ "type": "Feature", "properties": { "name": "FIELD RD/Nike Site", "clustered": true, "point_count": 3 }, "geometry": { "type": "Point", "coordinates": [ -122.527685, 37.829074 ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@ -762,13 +762,13 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "Geary Blvd & Powell St", "clustered": true, "point_count": 9 }, "geometry": { "type": "Point", "coordinates": [ -122.408402, 37.787403 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "Folsom St & 1st St", "clustered": true, "point_count": 4 }, "geometry": { "type": "Point", "coordinates": [ -122.394197, 37.787437 ] } }
|
||||
{ "type": "Feature", "properties": { "name": "Folsom St & 1st St", "clustered": true, "point_count": 5 }, "geometry": { "type": "Point", "coordinates": [ -122.394197, 37.787437 ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 12, "x": 1908, "y": 1582 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "muni", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE" }, "geometry": { "type": "Point", "coordinates": [ -12.240014, 37.820006 ] } }
|
||||
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "clustered": true, "point_count": 5 }, "geometry": { "type": "Point", "coordinates": [ -12.240014, 37.820006 ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@ -790,7 +790,7 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "FIELD RD/Nike Site" }, "geometry": { "type": "Point", "coordinates": [ -122.527674, 37.829065 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "Field Rd/Visitor Center", "clustered": true, "point_count": 2 }, "geometry": { "type": "Point", "coordinates": [ -122.524413, 37.830480 ] } }
|
||||
{ "type": "Feature", "properties": { "name": "Field Rd/Visitor Center", "clustered": true, "point_count": 5 }, "geometry": { "type": "Point", "coordinates": [ -122.524413, 37.830480 ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@ -920,7 +920,7 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "Lake Merced Blvd & Higuera Ave", "clustered": true, "point_count": 14 }, "geometry": { "type": "Point", "coordinates": [ -122.485210, 37.718429 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "Font Blvd & Juan Bautisa Cir." }, "geometry": { "type": "Point", "coordinates": [ -122.478697, 37.718480 ] } }
|
||||
{ "type": "Feature", "properties": { "name": "Font Blvd & Juan Bautisa Cir.", "clustered": true, "point_count": 2 }, "geometry": { "type": "Point", "coordinates": [ -122.478697, 37.718480 ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@ -1034,7 +1034,7 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "Fulton St & 16th Ave", "clustered": true, "point_count": 3 }, "geometry": { "type": "Point", "coordinates": [ -122.474921, 37.773055 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "Lincoln Way & 17th Ave" }, "geometry": { "type": "Point", "coordinates": [ -122.475425, 37.765618 ] } }
|
||||
{ "type": "Feature", "properties": { "name": "Lincoln Way & 17th Ave", "clustered": true, "point_count": 2 }, "geometry": { "type": "Point", "coordinates": [ -122.475425, 37.765618 ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@ -1068,7 +1068,7 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "Alexander Dr & Conzelman Rd" }, "geometry": { "type": "Point", "coordinates": [ -122.483386, 37.833149 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "CONZELMAN RD/Kirby Cove", "clustered": true, "point_count": 3 }, "geometry": { "type": "Point", "coordinates": [ -122.484030, 37.829523 ] } }
|
||||
{ "type": "Feature", "properties": { "name": "CONZELMAN RD/Kirby Cove", "clustered": true, "point_count": 4 }, "geometry": { "type": "Point", "coordinates": [ -122.484030, 37.829523 ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@ -1136,7 +1136,7 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "Moscow St & France Ave", "clustered": true, "point_count": 6 }, "geometry": { "type": "Point", "coordinates": [ -122.431136, 37.716698 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "South Hill Blvd & Chicago Way" }, "geometry": { "type": "Point", "coordinates": [ -122.431512, 37.710714 ] } }
|
||||
{ "type": "Feature", "properties": { "name": "South Hill Blvd & Chicago Way", "clustered": true, "point_count": 2 }, "geometry": { "type": "Point", "coordinates": [ -122.431512, 37.710714 ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@ -1320,7 +1320,7 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "Plymouth Ave & Lakeview Ave" }, "geometry": { "type": "Point", "coordinates": [ -122.456210, 37.718455 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "San Jose Ave & Mt Vernon Ave", "clustered": true, "point_count": 2 }, "geometry": { "type": "Point", "coordinates": [ -122.448667, 37.718522 ] } }
|
||||
{ "type": "Feature", "properties": { "name": "San Jose Ave & Mt Vernon Ave", "clustered": true, "point_count": 4 }, "geometry": { "type": "Point", "coordinates": [ -122.448667, 37.718522 ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@ -1498,7 +1498,7 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "14th St & Sanchez St", "clustered": true, "point_count": 2 }, "geometry": { "type": "Point", "coordinates": [ -122.431287, 37.767543 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "Market St & Sanchez St", "clustered": true, "point_count": 4 }, "geometry": { "type": "Point", "coordinates": [ -122.431222, 37.765635 ] } }
|
||||
{ "type": "Feature", "properties": { "name": "Market St & Sanchez St", "clustered": true, "point_count": 5 }, "geometry": { "type": "Point", "coordinates": [ -122.431222, 37.765635 ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@ -1820,7 +1820,7 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "Mansell St & John F Shelley Dr" }, "geometry": { "type": "Point", "coordinates": [ -122.414474, 37.718124 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "Ingerson Ave & Hawes St", "clustered": true, "point_count": 2 }, "geometry": { "type": "Point", "coordinates": [ -122.391000, 37.718047 ] } }
|
||||
{ "type": "Feature", "properties": { "name": "Ingerson Ave & Hawes St", "clustered": true, "point_count": 3 }, "geometry": { "type": "Point", "coordinates": [ -122.391000, 37.718047 ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@ -2180,7 +2180,7 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "Not a public stop", "clustered": true, "point_count": 5 }, "geometry": { "type": "Point", "coordinates": [ -122.386891, 37.755388 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "3rd St & 25th St", "clustered": true, "point_count": 7 }, "geometry": { "type": "Point", "coordinates": [ -122.387663, 37.753132 ] } }
|
||||
{ "type": "Feature", "properties": { "name": "3rd St & 25th St", "clustered": true, "point_count": 8 }, "geometry": { "type": "Point", "coordinates": [ -122.387663, 37.753132 ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@ -2198,7 +2198,7 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "Avenue M & 3rd St", "clustered": true, "point_count": 6 }, "geometry": { "type": "Point", "coordinates": [ -122.364886, 37.822235 ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "62 Macalla St", "clustered": true, "point_count": 2 }, "geometry": { "type": "Point", "coordinates": [ -122.364832, 37.812005 ] } }
|
||||
{ "type": "Feature", "properties": { "name": "62 Macalla St", "clustered": true, "point_count": 7 }, "geometry": { "type": "Point", "coordinates": [ -122.364832, 37.812005 ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@ -2224,7 +2224,7 @@
|
||||
,
|
||||
{ "type": "FeatureCollection", "properties": { "zoom": 13, "x": 3817, "y": 3165 }, "features": [
|
||||
{ "type": "FeatureCollection", "properties": { "layer": "muni", "version": 2, "extent": 4096 }, "features": [
|
||||
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE" }, "geometry": { "type": "Point", "coordinates": [ -12.240003, 37.820006 ] } }
|
||||
{ "type": "Feature", "properties": { "name": "REFERENCE & REFERENCE", "clustered": true, "point_count": 12 }, "geometry": { "type": "Point", "coordinates": [ -12.240003, 37.820006 ] } }
|
||||
] }
|
||||
] }
|
||||
] }
|
||||
|
38
tile.cpp
38
tile.cpp
@ -1695,6 +1695,44 @@ long long write_tile(FILE *geoms, long long *geompos_in, char *metabase, char *s
|
||||
}
|
||||
}
|
||||
|
||||
// Attach the leftover cluster count to the last feature that did make it
|
||||
if (clustered > 0) {
|
||||
if (partials.size() > 0) {
|
||||
size_t n = partials.size() - 1;
|
||||
|
||||
size_t i;
|
||||
for (i = 0; i < partials[n].full_keys.size(); i++) {
|
||||
if (partials[n].full_keys[i] == std::string("point_count")) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::string layername = (*layer_unmaps)[partials[n].segment][partials[n].layer];
|
||||
if (i < partials[n].full_keys.size()) {
|
||||
size_t sum = strtoul(partials[n].full_values[i].s.c_str(), NULL, 10) + clustered;
|
||||
partials[n].full_values[i].s = std::to_string(sum);
|
||||
|
||||
add_tilestats(layername, z, layermaps, tiling_seg, layer_unmaps, "point_count", partials[n].full_values[i]);
|
||||
} else {
|
||||
serial_val sv, sv2;
|
||||
|
||||
partials[n].full_keys.push_back("clustered");
|
||||
sv.type = mvt_bool;
|
||||
sv.s = "true";
|
||||
partials[n].full_values.push_back(sv);
|
||||
|
||||
add_tilestats(layername, z, layermaps, tiling_seg, layer_unmaps, "clustered", sv);
|
||||
|
||||
partials[n].full_keys.push_back("point_count");
|
||||
sv2.type = mvt_double;
|
||||
sv2.s = std::to_string(clustered + 1);
|
||||
partials[n].full_values.push_back(sv2);
|
||||
|
||||
add_tilestats(layername, z, layermaps, tiling_seg, layer_unmaps, "point_count", sv2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (prefilter != NULL) {
|
||||
json_end(prefilter_jp);
|
||||
if (fclose(prefilter_read_fp) != 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user