Fix bugs in --no-simplification-of-shared-nodes (#99)

* Fix bugs in --no-simplification-of-shared-nodes

* Update changelog
This commit is contained in:
Erica Fischer
2023-05-08 15:31:46 -07:00
committed by GitHub
parent 605640e138
commit 523ca55243
9 changed files with 47 additions and 11 deletions
+8
View File
@@ -1,3 +1,11 @@
# 2.26.0
* Fix bugs in --no-simplification-of-shared-nodes
* Updated dockerfile (jtmiclat)
* Set build options to use C++-17 (james2432)
* Use std::fpclassify instead of plain fpclassify (james)
* Fix pmtiles warnings (bdon)
# 2.25.0
* Add `--include`/`-y` option to tile-join
+2
View File
@@ -933,6 +933,8 @@ drawvec simplify_lines(drawvec &geom, int z, int detail, bool mark_tile_bounds,
geom[i].necessary = 1;
} else if (geom[i].op == VT_LINETO) {
geom[i].necessary = 0;
// if this is actually the endpoint, not an intermediate point,
// it will be marked as necessary below
} else {
geom[i].necessary = 1;
}
+2 -2
View File
@@ -34,7 +34,7 @@
#include <map>
#include <cmath>
#if defined(__APPLE__) || defined(__FreeBSD__)
#if defined(__APPLE__) || defined(__FreeBSD__)
#include <sys/types.h>
#include <sys/sysctl.h>
#include <sys/param.h>
@@ -3521,7 +3521,7 @@ int main(int argc, char **argv) {
long long file_bbox[4] = {UINT_MAX, UINT_MAX, 0, 0};
long long file_bbox1[4] = {0xFFFFFFFF, 0xFFFFFFFF, 0, 0}; // standard -180 to 180 world plane
long long file_bbox1[4] = {0xFFFFFFFF, 0xFFFFFFFF, 0, 0}; // standard -180 to 180 world plane
long long file_bbox2[4] = {0x1FFFFFFFF, 0xFFFFFFFF, 0x100000000, 0}; // 0 to 360 world plane
auto input_ret = read_input(sources, name ? name : out_mbtiles ? out_mbtiles
+1 -1
View File
@@ -88,7 +88,7 @@ struct reader {
long long file_bbox[4] = {0, 0, 0, 0};
long long file_bbox1[4] = {0xFFFFFFFF, 0xFFFFFFFF, 0, 0}; // standard -180 to 180 world plane
long long file_bbox1[4] = {0xFFFFFFFF, 0xFFFFFFFF, 0, 0}; // standard -180 to 180 world plane
long long file_bbox2[4] = {0x1FFFFFFFF, 0xFFFFFFFF, 0x100000000, 0}; // 0 to 360 world plane
struct stat geomst {};
+2
View File
@@ -0,0 +1,2 @@
{ "type": "Feature", "properties": { "LINEARID": "11074706697", "FULLNAME": "Fishers Pointe Blvd", "RTTYP": "M", "MTFCC": "S1400" }, "geometry": { "type": "LineString", "coordinates": [ [ -86.0174959, 39.951407 ], [ -86.0174409, 39.951459 ], [ -86.0173849, 39.951489 ], [ -86.0173059, 39.95151 ], [ -86.0172479, 39.951512 ], [ -86.0171679, 39.951503 ], [ -86.0171439, 39.951492 ], [ -86.0170519, 39.951437 ], [ -86.0170169, 39.951391 ], [ -86.0169949, 39.95133 ], [ -86.0169909, 39.951284 ], [ -86.0170079, 39.95123 ], [ -86.0170479, 39.951177 ], [ -86.0170959, 39.951141 ], [ -86.0171229, 39.95113 ] ] } }
{ "type": "Feature", "properties": { "LINEARID": "11074705426", "FULLNAME": "Fountainview Ln", "RTTYP": "M", "MTFCC": "S1400" }, "geometry": { "type": "LineString", "coordinates": [ [ -86.0174659, 39.954021 ], [ -86.0175089, 39.953939 ], [ -86.0175239, 39.953883 ], [ -86.0175299, 39.953807 ], [ -86.0175309, 39.953668 ], [ -86.0175259, 39.953265 ], [ -86.0175179, 39.953216 ], [ -86.0175009, 39.953166 ], [ -86.0174579, 39.953088 ], [ -86.0174149, 39.95304 ], [ -86.0173559, 39.952988 ], [ -86.0172939, 39.952953 ], [ -86.0170609, 39.952854 ], [ -86.0166669, 39.952699 ], [ -86.0165839, 39.952646 ], [ -86.0165439, 39.952598 ], [ -86.0165239, 39.952538 ], [ -86.0165139, 39.952467 ], [ -86.0165269, 39.952399 ], [ -86.0165629, 39.952339 ], [ -86.0171439, 39.951492 ] ] } }
@@ -0,0 +1,22 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-86.017531,39.951130,-86.016514,39.954021",
"bounds": "-86.017531,39.951130,-86.016514,39.954021",
"center": "-86.017531,39.954021,11",
"description": "tests/intersection/out/-Z11_-z11_--extra-detail_13_--no-simplification-of-shared-nodes.json.check.mbtiles",
"format": "pbf",
"generator_options": "./tippecanoe -q -a@ -f -o tests/intersection/out/-Z11_-z11_--extra-detail_13_--no-simplification-of-shared-nodes.json.check.mbtiles -Z11 -z11 --extra-detail 13 --no-simplification-of-shared-nodes tests/intersection/in.json",
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":11,\"maxzoom\":11,\"fields\":{\"FULLNAME\":\"String\",\"LINEARID\":\"String\",\"MTFCC\":\"String\",\"RTTYP\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":2,\"geometry\":\"LineString\",\"attributeCount\":4,\"attributes\":[{\"attribute\":\"FULLNAME\",\"count\":2,\"type\":\"string\",\"values\":[\"Fishers Pointe Blvd\",\"Fountainview Ln\"]},{\"attribute\":\"LINEARID\",\"count\":2,\"type\":\"string\",\"values\":[\"11074705426\",\"11074706697\"]},{\"attribute\":\"MTFCC\",\"count\":1,\"type\":\"string\",\"values\":[\"S1400\"]},{\"attribute\":\"RTTYP\",\"count\":1,\"type\":\"string\",\"values\":[\"M\"]}]}]}}",
"maxzoom": "11",
"minzoom": "11",
"name": "tests/intersection/out/-Z11_-z11_--extra-detail_13_--no-simplification-of-shared-nodes.json.check.mbtiles",
"type": "overlay",
"version": "2"
}, "features": [
{ "type": "FeatureCollection", "properties": { "zoom": 11, "x": 534, "y": 775 }, "features": [
{ "type": "FeatureCollection", "properties": { "layer": "in", "version": 2, "extent": 8192 }, "features": [
{ "type": "Feature", "properties": { "LINEARID": "11074705426", "FULLNAME": "Fountainview Ln", "RTTYP": "M", "MTFCC": "S1400" }, "geometry": { "type": "LineString", "coordinates": [ [ -86.017456, 39.954014 ], [ -86.017520, 39.953668 ], [ -86.017520, 39.953257 ], [ -86.017456, 39.953093 ], [ -86.017284, 39.952961 ], [ -86.016576, 39.952648 ], [ -86.016512, 39.952468 ], [ -86.017134, 39.951497 ] ] } }
,
{ "type": "Feature", "properties": { "LINEARID": "11074706697", "FULLNAME": "Fishers Pointe Blvd", "RTTYP": "M", "MTFCC": "S1400" }, "geometry": { "type": "LineString", "coordinates": [ [ -86.017499, 39.951415 ], [ -86.017306, 39.951513 ], [ -86.017134, 39.951497 ], [ -86.017027, 39.951398 ], [ -86.016984, 39.951283 ], [ -86.017113, 39.951135 ] ] } }
] }
] }
] }
+1 -3
View File
@@ -1178,7 +1178,7 @@ int main(int argc, char **argv) {
std::string sa;
filearg = 1;
while (getline(read_file, sa)) {
char* c = const_cast<char*>(sa.c_str());
char *c = const_cast<char *>(sa.c_str());
reader *r = begin_reading(c);
struct reader **rr;
for (rr = &readers; *rr != NULL; rr = &((*rr)->next)) {
@@ -1191,7 +1191,6 @@ int main(int argc, char **argv) {
}
read_file.close();
}
}
case 'q':
@@ -1262,7 +1261,6 @@ int main(int argc, char **argv) {
std::string description;
std::string name;
if (filearg == 0) {
for (i = optind; i < argc; i++) {
reader *r = begin_reading(argv[i]);
+8 -4
View File
@@ -554,7 +554,11 @@ double simplify_partial(partial *p, drawvec &shared_nodes) {
// Only matters if simplification is set higher than the tiny polygon size.
// Tiny polygons that are part of a tiny multipolygon will still get simplified.
if (!p->reduced) {
if (t == VT_LINE) {
// These aren't necessarily actually no-ops until we scale down.
// Don't do it if we are trying to preserve intersections, because
// it might wipe out the intersection and spoil the matching even though
// it would leave something else within the same tile pixel.
if (t == VT_LINE && !prevent[P_SIMPLIFY_SHARED_NODES]) {
// continues to deduplicate to line_detail even if we have extra detail
geom = remove_noop(geom, t, 32 - z - line_detail);
}
@@ -2253,7 +2257,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
partials.push_back(p);
unsimplified_geometry_size += sf.geometry.size() * sizeof(draw);
if (unsimplified_geometry_size > 10 * 1024 * 1024 && !additional[A_DETECT_SHARED_BORDERS]) {
if (unsimplified_geometry_size > 10 * 1024 * 1024 && !additional[A_DETECT_SHARED_BORDERS] && !prevent[P_SIMPLIFY_SHARED_NODES]) {
drawvec dv;
for (; simplified_geometry_through < partials.size(); simplified_geometry_through++) {
@@ -2284,7 +2288,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
just_shared_nodes.push_back(shared_nodes[i]);
draw d = shared_nodes[i];
i++;
i++; // consume the first, point at the duplicate
while (i + 1 < shared_nodes.size() && shared_nodes[i + 1] == d) {
i++;
}
@@ -2301,7 +2305,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
std::string layername = (*layer_unmaps)[p.segment][p.layer];
serial_val sv, sv2, sv3, sv4;
long long point_count = p.clustered + 1;
char abbrev[17]; // to_string(LLONG_MAX).length() / 1000 + 1;
char abbrev[17]; // to_string(LLONG_MAX).length() / 1000 + 1;
p.full_keys.push_back("clustered");
sv.type = mvt_bool;
+1 -1
View File
@@ -1,6 +1,6 @@
#ifndef VERSION_HPP
#define VERSION_HPP
#define VERSION "v2.25.0"
#define VERSION "v2.26.0"
#endif