Compare commits

..
Author SHA1 Message Date
Erica Fischer 02e9e4e952 Only accept longitude corrections that give rings the right winding 2023-12-11 13:38:54 -08:00
Erica Fischer f53d9f77d2 Add more comments 2023-12-11 12:07:42 -08:00
Erica Fischer c719ce2fe5 Merge remote-tracking branch 'origin/main' into polar-buffer 2023-12-11 12:04:51 -08:00
Erica Fischer 15a3e313ff Tolerate polygon rings with insufficiently many points in input (#175)
* Tolerate polygon rings with insufficiently many points in input

* Fix changelog typo
2023-12-11 11:14:26 -08:00
Erica Fischer 80ac56a0b3 Don't use longitude wraparound detection if it makes a contradictory geometry 2023-12-11 11:00:03 -08:00
Erica Fischer d7bdbe363b Reduce maximum memory used for vertex sorting (#170)
* Add logging for out-of-memory debugging

* Use less memory for sub-sorting

* Reduce maximum memory used for vertex sorting
2023-11-30 13:48:50 -08:00
19 changed files with 187 additions and 97 deletions
+9 -1
View File
@@ -1,6 +1,14 @@
# 2.39.0
* Don't use longitude wraparound detection if it makes a self-contradictory geometry
# 2.38.0
* Add --reject-null-geometry and more checking of GeoJSON polygon and linestring validity
* Tolerate polygon rings with insuffiently many points in input
# 2.37.1
* Reduce maximum memory used for vertex sorting
# 2.37.0
-1
View File
@@ -533,7 +533,6 @@ the same layer, enclose them in an `all` expression so they will all be evaluate
* `-pW` or `--reverse-source-polygon-winding`: Instead of respecting GeoJSON polygon ring order, use the opposite of the original polygon winding in the source data to distinguish inner (counterclockwise) and outer (clockwise) polygon rings.
* `--clip-bounding-box=`*minlon*`,`*minlat*`,`*maxlon*`,`*maxlat*: Clip all features to the specified bounding box.
* `-aP` or `--convert-polygons-to-label-points`: Replace polygon geometries with a label point or points for the polygon in each tile it intersects.
* `--reject-null-geometry`: Exit with an error when a feature has a `null` geometry instead of just giving a warning.
### Setting or disabling tile size limits
-1
View File
@@ -19,6 +19,5 @@
#define EXIT_UNLINK 118
#define EXIT_UTF8 119
#define EXIT_WRITE 120
#define EXIT_INCORRECT_GEOMETRY 121
// avoid 124, 125, 126, 127, 137, which are used by GNU timeout
-4
View File
@@ -49,10 +49,6 @@ int serialize_geojson_feature(struct serialization_state *sst, json_object *geom
fprintf(stderr, "%s:%d: null geometry (additional not reported): ", sst->fname, sst->line);
json_context(feature);
warned = 1;
if (additional[A_REJECT_NULL_GEOMETRY]) {
exit(EXIT_INCORRECT_GEOMETRY);
}
}
return 0;
+9 -2
View File
@@ -642,9 +642,9 @@ drawvec fix_polygon(drawvec &geom) {
// A polygon ring must contain at least three points
// (and really should contain four). If this one does
// not have enough, avoid a division by zero trying to
// not have any, avoid a division by zero trying to
// calculate the centroid below.
if (j - i < 3) {
if (j - i < 1) {
i = j - 1;
outer = 0;
continue;
@@ -661,6 +661,13 @@ drawvec fix_polygon(drawvec &geom) {
ring.push_back(ring[0]);
}
// A polygon ring at this point should contain at least four points.
// Flesh it out with some vertex copies if it doesn't.
while (ring.size() < 4) {
ring.push_back(ring[0]);
}
// Reverse ring if winding order doesn't match
// inner/outer expectation
+2 -3
View File
@@ -2041,7 +2041,7 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
vertex_readers.push_back(readers[i].vertexfile);
rewind(readers[i].vertexfile);
}
fqsort(vertex_readers, sizeof(vertex), vertexcmp, vertex_out, memsize / 10);
fqsort(vertex_readers, sizeof(vertex), vertexcmp, vertex_out, memsize / 20);
for (size_t i = 0; i < CPUS; i++) {
if (fclose(readers[i].vertexfile) != 0) {
@@ -2107,7 +2107,7 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
rewind(readers[i].nodefile);
}
fqsort(node_readers, sizeof(node), nodecmp, node_out, memsize / 10);
fqsort(node_readers, sizeof(node), nodecmp, node_out, memsize / 20);
for (size_t i = 0; i < CPUS; i++) {
if (fclose(readers[i].nodefile) != 0) {
@@ -3214,7 +3214,6 @@ int main(int argc, char **argv) {
{"reverse-source-polygon-winding", no_argument, &prevent[P_REVERSE_SOURCE_POLYGON_WINDING], 1},
{"clip-bounding-box", required_argument, 0, '~'},
{"convert-polygons-to-label-points", no_argument, &additional[A_GENERATE_POLYGON_LABEL_POINTS], 1},
{"reject-null-geometry", no_argument, &additional[A_REJECT_NULL_GEOMETRY], 1},
{"Filtering tile contents", 0, 0, 0},
{"prefilter", required_argument, 0, 'C'},
-2
View File
@@ -695,8 +695,6 @@ the line or polygon within one tile unit of its proper location. You can probabl
\fB\fC\-\-clip\-bounding\-box=\fR\fIminlon\fP\fB\fC,\fR\fIminlat\fP\fB\fC,\fR\fImaxlon\fP\fB\fC,\fR\fImaxlat\fP: Clip all features to the specified bounding box.
.IP \(bu 2
\fB\fC\-aP\fR or \fB\fC\-\-convert\-polygons\-to\-label\-points\fR: Replace polygon geometries with a label point or points for the polygon in each tile it intersects.
.IP \(bu 2
\fB\fC\-\-reject\-null\-geometry\fR: Exit with an error when a feature has a \fB\fCnull\fR geometry instead of just giving a warning.
.RE
.SS Setting or disabling tile size limits
.RS
-1
View File
@@ -26,7 +26,6 @@
#define A_HILBERT ((int) 'h')
#define A_VISVALINGAM ((int) 'v')
#define A_GENERATE_POLYGON_LABEL_POINTS ((int) 'P')
#define A_REJECT_NULL_GEOMETRY ((int) '0')
#define P_SIMPLIFY ((int) 's')
#define P_SIMPLIFY_LOW ((int) 'S')
-18
View File
@@ -103,14 +103,6 @@ void parse_geometry(int t, json_object *j, drawvec &out, int op, const char *fna
}
if (t == GEOM_POLYGON) {
if (out.size() < 3) {
fprintf(stderr, "%s:%d: polygon must contain at least three points: ", fname, line);
json_context(j);
fprintf(stderr, "%s:%d: polygon must contain at least three points: ", fname, line);
json_context(feature);
exit(EXIT_INCORRECT_GEOMETRY);
}
// Note that this is not using the correct meaning of closepath.
//
// We are using it here to close an entire Polygon, to distinguish
@@ -122,16 +114,6 @@ void parse_geometry(int t, json_object *j, drawvec &out, int op, const char *fna
out.push_back(draw(VT_CLOSEPATH, 0, 0));
}
if (t == GEOM_LINESTRING) {
if (out.size() < 2) {
fprintf(stderr, "%s:%d: linestring must contain at least two points: ", fname, line);
json_context(j);
fprintf(stderr, "%s:%d: linestring must contain at least two points: ", fname, line);
json_context(feature);
exit(EXIT_INCORRECT_GEOMETRY);
}
}
}
void stringify_value(json_object *value, int &type, std::string &stringified, const char *reading, int line, json_object *feature) {
+108 -29
View File
@@ -313,41 +313,120 @@ serial_feature deserialize_feature(std::string &geoms, unsigned z, unsigned tx,
return sf;
}
static long long scale_geometry(struct serialization_state *sst, long long *bbox, drawvec &geom) {
long long offset = 0;
long long prev = 0;
bool has_prev = false;
static long long scale_geometry(struct serialization_state *sst, long long *bbox, drawvec &geom, int t) {
double scale = 1.0 / (1 << geometry_scale);
if (additional[A_DETECT_WRAPAROUND]) {
drawvec out;
bool outer = true; // first ring is expected to be outer
for (size_t i = 0; i < geom.size(); i++) {
if (geom[i].op == VT_MOVETO) {
size_t j = 0;
for (j = i + 1; j < geom.size(); j++) {
if (geom[j].op != VT_LINETO) {
break;
}
}
long long prev_x = geom[i].x;
long long offset = 0;
bool balanced = true;
drawvec ring;
bool changed = false;
for (size_t k = i; k < j; k++) {
draw op = geom[k];
op.x += offset;
// jumps at least 180° but not exactly 360°,
// which in some data sets is an intentional
// line across the world
if (op.x - prev_x > (1LL << 31) && op.x - prev_x != (1LL << 32)) {
if (offset < 0) {
// already shifted left, but seems to need another shift left
balanced = false;
break;
}
offset -= 1LL << 32;
op.x -= 1LL << 32;
changed = true;
} else if (prev_x - op.x > (1LL << 31) && prev_x - op.x != (1LL << 32)) {
if (offset > 0) {
// already shifted right, but seems to need another shift right
balanced = false;
break;
}
offset += 1LL << 32;
op.x += 1LL << 32;
changed = true;
}
ring.push_back(op);
prev_x = op.x;
}
if (changed && balanced) {
// If this is a polygon, in which the first and last
// points of each ring are supposed to be identical,
// make sure the antimeridian wraparound detection
// preserves that expectation. If it doesn't, it means
// we have detected something wrongly.
if (geom[j - 1] == geom[i]) {
if (offset != 0) {
// first and last points are supposed to be the same
// but there is an unresolved antimeridian shift
balanced = false;
}
}
if (t == VT_POLYGON) {
// don't accept longitude corrections that would give
// a ring a winding counter to what the geojson structure
// says the winding should be
double area_after = get_area(ring, 0, ring.size());
if ((outer && area_after < 0) ||
(!outer && area_after > 0)) {
// wraparound detection gave a ring a winding different from
// what its position in the GeoJSON structure indicates that
// it should have.
balanced = false;
}
}
}
// If something contradictory happened in longitude
// wraparound detection, restore the original geometry
if (!balanced) {
ring.clear();
for (size_t k = i; k < j; k++) {
ring.push_back(geom[k]);
}
}
for (auto const &g : ring) {
out.push_back(g);
}
i = j - 1;
outer = false;
} else if (geom[i].op == VT_CLOSEPATH) {
out.push_back(geom[i]);
outer = true;
}
}
geom = std::move(out);
}
for (size_t i = 0; i < geom.size(); i++) {
if (geom[i].op == VT_MOVETO || geom[i].op == VT_LINETO) {
long long x = geom[i].x;
long long y = geom[i].y;
if (additional[A_DETECT_WRAPAROUND]) {
if (geom[i].op == VT_LINETO) {
x += offset;
if (has_prev) {
// jumps at least 180° but not exactly 360°,
// which in some data sets is an intentional
// line across the world
if (x - prev > (1LL << 31) && x - prev != (1LL << 32)) {
offset -= 1LL << 32;
x -= 1LL << 32;
} else if (prev - x > (1LL << 31) && prev - x != (1LL << 32)) {
offset += 1LL << 32;
x += 1LL << 32;
}
}
has_prev = true;
prev = x;
} else {
offset = 0;
prev = x;
}
}
if (x < bbox[0]) {
bbox[0] = x;
}
@@ -464,7 +543,7 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf) {
// try to remind myself that the geometry in this function is in SCALED COORDINATES
drawvec scaled_geometry = sf.geometry;
sf.geometry.clear();
scale_geometry(sst, sf.bbox, scaled_geometry);
scale_geometry(sst, sf.bbox, scaled_geometry, sf.t);
// This has to happen after scaling so that the wraparound detection has happened first.
// Otherwise the inner/outer calculation will be confused by bad geometries.
+5 -1
View File
@@ -4,12 +4,16 @@
#include <vector>
#include <string>
#define MAX_MEMORY (10 * 1024 * 1024)
#define MAX_MEMORY (1024 * 1024 * 1024) // 1 GB
void fqsort(std::vector<FILE *> &inputs, size_t width, int (*cmp)(const void *, const void *), FILE *out, size_t mem) {
std::string pivot;
FILE *fp1, *fp2;
if (mem > MAX_MEMORY) {
mem = MAX_MEMORY;
}
{
// read some elements into memory to choose a pivot from
//
+15
View File
@@ -0,0 +1,15 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "1.000000,2.000000,1.000000,2.000000",
"bounds": "1.000000,2.000000,1.000000,2.000000",
"center": "1.000000,2.000000,0",
"description": "tests/invalid-linestring/out/-z0.json.check.mbtiles",
"format": "pbf",
"generator_options": "./tippecanoe -q -a@ -f -o tests/invalid-linestring/out/-z0.json.check.mbtiles -z0 tests/invalid-linestring/too-few.json",
"json": "{\"vector_layers\":[{\"id\":\"toofew\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"toofew\",\"count\":1,\"geometry\":\"LineString\",\"attributeCount\":0,\"attributes\":[]}]}}",
"maxzoom": "0",
"minzoom": "0",
"name": "tests/invalid-linestring/out/-z0.json.check.mbtiles",
"type": "overlay",
"version": "2"
}, "features": [
] }
+1
View File
@@ -0,0 +1 @@
{ "type": "Feature", "properties": {}, "geometry": { "type": "LineString", "coordinates": [ [ 1, 2 ] ] } }
+1
View File
@@ -0,0 +1 @@
{ "type": "Feature", "properties": { "handle": 717, "block": -1, "etype": 13, "space": 0, "layer": "0", "olinetype": "BYLAYER", "linetype": "", "color": "0,0,0,255", "ocolor": 7, "color24": -1, "transparency": 0, "lweight": -1, "linewidth": 0.0, "ltscale": 1.0, "visible": 1, "thickness": 0.0, "ext": null, "name": "SOLID", "solid": 1, "associative": 0, "hstyle": 1, "hpattern": 1, "doubleflag": 0, "angle": 0.0, "scale": 0.0, "deflines": 0 }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -135.2329619, -85.526118 ], [ -135.2329619, -85.526118 ] ] ] ] } }
+15
View File
@@ -0,0 +1,15 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "180.000000,85.051129,-180.000000,-85.051129",
"bounds": "-135.232962,-85.051129,-135.232962,-85.051129",
"center": "-135.232962,-85.051129,0",
"description": "tests/invalid-polygon/out/-z0.json.check.mbtiles",
"format": "pbf",
"generator_options": "./tippecanoe -q -a@ -f -o tests/invalid-polygon/out/-z0.json.check.mbtiles -z0 tests/invalid-polygon/in.json",
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{\"angle\":\"Number\",\"associative\":\"Number\",\"block\":\"Number\",\"color\":\"String\",\"color24\":\"Number\",\"deflines\":\"Number\",\"doubleflag\":\"Number\",\"etype\":\"Number\",\"handle\":\"Number\",\"hpattern\":\"Number\",\"hstyle\":\"Number\",\"layer\":\"String\",\"linetype\":\"String\",\"linewidth\":\"Number\",\"ltscale\":\"Number\",\"lweight\":\"Number\",\"name\":\"String\",\"ocolor\":\"Number\",\"olinetype\":\"String\",\"scale\":\"Number\",\"solid\":\"Number\",\"space\":\"Number\",\"thickness\":\"Number\",\"transparency\":\"Number\",\"visible\":\"Number\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":1,\"geometry\":\"Polygon\",\"attributeCount\":25,\"attributes\":[{\"attribute\":\"angle\",\"count\":1,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":0},{\"attribute\":\"associative\",\"count\":1,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":0},{\"attribute\":\"block\",\"count\":1,\"type\":\"number\",\"values\":[-1],\"min\":-1,\"max\":-1},{\"attribute\":\"color\",\"count\":1,\"type\":\"string\",\"values\":[\"0,0,0,255\"]},{\"attribute\":\"color24\",\"count\":1,\"type\":\"number\",\"values\":[-1],\"min\":-1,\"max\":-1},{\"attribute\":\"deflines\",\"count\":1,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":0},{\"attribute\":\"doubleflag\",\"count\":1,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":0},{\"attribute\":\"etype\",\"count\":1,\"type\":\"number\",\"values\":[13],\"min\":13,\"max\":13},{\"attribute\":\"handle\",\"count\":1,\"type\":\"number\",\"values\":[717],\"min\":717,\"max\":717},{\"attribute\":\"hpattern\",\"count\":1,\"type\":\"number\",\"values\":[1],\"min\":1,\"max\":1},{\"attribute\":\"hstyle\",\"count\":1,\"type\":\"number\",\"values\":[1],\"min\":1,\"max\":1},{\"attribute\":\"layer\",\"count\":1,\"type\":\"string\",\"values\":[\"0\"]},{\"attribute\":\"linetype\",\"count\":1,\"type\":\"string\",\"values\":[\"\"]},{\"attribute\":\"linewidth\",\"count\":1,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":0},{\"attribute\":\"ltscale\",\"count\":1,\"type\":\"number\",\"values\":[1],\"min\":1,\"max\":1},{\"attribute\":\"lweight\",\"count\":1,\"type\":\"number\",\"values\":[-1],\"min\":-1,\"max\":-1},{\"attribute\":\"name\",\"count\":1,\"type\":\"string\",\"values\":[\"SOLID\"]},{\"attribute\":\"ocolor\",\"count\":1,\"type\":\"number\",\"values\":[7],\"min\":7,\"max\":7},{\"attribute\":\"olinetype\",\"count\":1,\"type\":\"string\",\"values\":[\"BYLAYER\"]},{\"attribute\":\"scale\",\"count\":1,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":0},{\"attribute\":\"solid\",\"count\":1,\"type\":\"number\",\"values\":[1],\"min\":1,\"max\":1},{\"attribute\":\"space\",\"count\":1,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":0},{\"attribute\":\"thickness\",\"count\":1,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":0},{\"attribute\":\"transparency\",\"count\":1,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":0},{\"attribute\":\"visible\",\"count\":1,\"type\":\"number\",\"values\":[1],\"min\":1,\"max\":1}]}]}}",
"maxzoom": "0",
"minzoom": "0",
"name": "tests/invalid-polygon/out/-z0.json.check.mbtiles",
"type": "overlay",
"version": "2"
}, "features": [
] }
File diff suppressed because one or more lines are too long
@@ -0,0 +1,20 @@
{ "type": "FeatureCollection", "properties": {
"antimeridian_adjusted_bounds": "-179.084872,-42.586987,179.718436,64.188520",
"bounds": "-179.084872,-85.051129,179.718436,64.188520",
"center": "0.000000,0.000000,0",
"description": "tests/wraparound-gap/out/-z0_--detect-longitude-wraparound.json.check.mbtiles",
"format": "pbf",
"generator_options": "./tippecanoe -q -a@ -f -o tests/wraparound-gap/out/-z0_--detect-longitude-wraparound.json.check.mbtiles -z0 --detect-longitude-wraparound tests/wraparound-gap/in.json",
"json": "{\"vector_layers\":[{\"id\":\"in\",\"description\":\"\",\"minzoom\":0,\"maxzoom\":0,\"fields\":{\"felt:color\":\"String\",\"felt:fillOpacity\":\"Number\",\"felt:id\":\"String\",\"felt:locked\":\"Number\",\"felt:ordering\":\"Number\",\"felt:showArea\":\"Number\",\"felt:strokeOpacity\":\"Number\",\"felt:strokeStyle\":\"String\",\"felt:strokeWidth\":\"Number\",\"felt:type\":\"String\"}}],\"tilestats\":{\"layerCount\":1,\"layers\":[{\"layer\":\"in\",\"count\":1,\"geometry\":\"Polygon\",\"attributeCount\":10,\"attributes\":[{\"attribute\":\"felt:color\",\"count\":1,\"type\":\"string\",\"values\":[\"#C93535\"]},{\"attribute\":\"felt:fillOpacity\",\"count\":1,\"type\":\"number\",\"values\":[0.25],\"min\":0.25,\"max\":0.25},{\"attribute\":\"felt:id\",\"count\":1,\"type\":\"string\",\"values\":[\"fdd67048-a864-48d1-9596-fe332d5e2fd8\"]},{\"attribute\":\"felt:locked\",\"count\":1,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":0},{\"attribute\":\"felt:ordering\",\"count\":1,\"type\":\"number\",\"values\":[1701884658553581],\"min\":1701884658553581,\"max\":1701884658553581},{\"attribute\":\"felt:showArea\",\"count\":1,\"type\":\"number\",\"values\":[0],\"min\":0,\"max\":0},{\"attribute\":\"felt:strokeOpacity\",\"count\":1,\"type\":\"number\",\"values\":[1],\"min\":1,\"max\":1},{\"attribute\":\"felt:strokeStyle\",\"count\":1,\"type\":\"string\",\"values\":[\"solid\"]},{\"attribute\":\"felt:strokeWidth\",\"count\":1,\"type\":\"number\",\"values\":[2],\"min\":2,\"max\":2},{\"attribute\":\"felt:type\",\"count\":1,\"type\":\"string\",\"values\":[\"Polygon\"]}]}]}}",
"maxzoom": "0",
"minzoom": "0",
"name": "tests/wraparound-gap/out/-z0_--detect-longitude-wraparound.json.check.mbtiles",
"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": { "felt:color": "#C93535", "felt:fillOpacity": 0.25, "felt:id": "fdd67048-a864-48d1-9596-fe332d5e2fd8", "felt:locked": 0, "felt:ordering": 1701884658553581, "felt:showArea": 0, "felt:strokeOpacity": 1, "felt:strokeStyle": "solid", "felt:strokeWidth": 2, "felt:type": "Polygon" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -68.730469, 64.206377 ], [ -63.281250, 64.052978 ], [ -60.644531, 63.898731 ], [ -55.371094, 63.391522 ], [ -52.910156, 63.074866 ], [ -50.361328, 62.714462 ], [ -45.615234, 61.856149 ], [ -41.220703, 60.802064 ], [ -37.089844, 59.578851 ], [ -35.156250, 58.904646 ], [ -29.707031, 56.704506 ], [ -24.960938, 54.213861 ], [ -19.511719, 50.569283 ], [ -15.996094, 47.576526 ], [ -10.986328, 42.293564 ], [ -8.349609, 38.959409 ], [ -3.164062, 30.600094 ], [ 0.527344, 22.998852 ], [ 3.779297, 16.888660 ], [ 6.679688, 12.125264 ], [ 10.722656, 4.740675 ], [ 16.435547, -6.751896 ], [ 25.048828, -12.382928 ], [ 37.353516, -19.890723 ], [ 44.824219, -23.966176 ], [ 55.019531, -28.921631 ], [ 64.160156, -32.694866 ], [ 70.927734, -35.029996 ], [ 75.146484, -36.315125 ], [ 82.177734, -38.203655 ], [ 89.472656, -39.774769 ], [ 93.955078, -40.580585 ], [ 98.525391, -41.244772 ], [ 103.183594, -41.771312 ], [ 109.511719, -42.293564 ], [ 115.927734, -42.553080 ], [ 122.431641, -42.553080 ], [ 128.935547, -42.293564 ], [ 133.857422, -41.902277 ], [ 137.197266, -41.508577 ], [ 143.789062, -40.044438 ], [ 145.283203, -39.571822 ], [ 151.171875, -37.439974 ], [ 156.796875, -35.101934 ], [ 166.113281, -30.524413 ], [ 173.671875, -26.194877 ], [ 179.736328, -22.350076 ], [ 179.736328, -85.622069 ], [ -179.121094, -85.622069 ], [ -179.121094, -21.534847 ], [ -157.939453, -6.140555 ], [ -143.437500, 13.838080 ], [ -140.712891, 20.632784 ], [ -137.109375, 28.459033 ], [ -133.593750, 34.597042 ], [ -130.429688, 39.368279 ], [ -128.671875, 41.640078 ], [ -123.662109, 47.040182 ], [ -118.916016, 51.013755 ], [ -117.597656, 51.944265 ], [ -113.291016, 54.622978 ], [ -110.039062, 56.316537 ], [ -106.611328, 57.844751 ], [ -102.832031, 59.265881 ], [ -96.591797, 61.100789 ], [ -92.021484, 62.103883 ], [ -87.187500, 62.955223 ], [ -84.638672, 63.273182 ], [ -79.453125, 63.821288 ], [ -76.816406, 63.975961 ], [ -71.367188, 64.168107 ], [ -68.730469, 64.206377 ] ] ], [ [ [ 187.031250, -17.224758 ], [ 187.031250, -85.622069 ], [ 180.878906, -85.622069 ], [ 180.878906, -21.534847 ], [ 187.031250, -17.224758 ] ] ], [ [ [ -180.263672, -22.350076 ], [ -180.263672, -85.622069 ], [ -187.031250, -85.622069 ], [ -187.031250, -26.588527 ], [ -180.263672, -22.350076 ] ] ] ] } }
] }
] }
] }
-33
View File
@@ -1609,34 +1609,6 @@ serial_feature next_feature(decompressor *geoms, std::atomic<long long> *geompos
}
}
bool legit_geometry(int t, const drawvec &g) {
bool legit = false;
for (size_t i = 0; i < g.size(); i++) {
if (g[i].op == VT_MOVETO) {
size_t j;
for (j = i + 1; j < g.size(); j++) {
if (g[j].op != VT_LINETO) {
break;
}
}
if (t == VT_LINE && j < i + 2) {
return false;
}
if (t == VT_POLYGON && j < i + 3) {
return false;
}
legit = true; // must contain at least one ring
i = j - 1;
}
}
return legit;
}
struct run_prefilter_args {
decompressor *geoms = NULL;
std::atomic<long long> *geompos_in = NULL;
@@ -1685,11 +1657,6 @@ void *run_prefilter(void *v) {
tmp_layer.extent = 1LL << 32;
tmp_layer.name = (*(rpa->layer_unmaps))[sf.segment][sf.layer];
// make sure the geometry is actually legal geojson
if (!legit_geometry(sf.t, sf.geometry)) {
continue;
}
if (sf.t == VT_POLYGON) {
sf.geometry = close_poly(sf.geometry);
}
+1 -1
View File
@@ -1,6 +1,6 @@
#ifndef VERSION_HPP
#define VERSION_HPP
#define VERSION "v2.38.0"
#define VERSION "v2.39.0"
#endif