mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-04 17:35:42 +02:00
Merge remote-tracking branch 'origin/main' into clean-polygons
This commit is contained in:
@@ -1,3 +1,11 @@
|
|||||||
|
# 2.38.0
|
||||||
|
|
||||||
|
* Tolerate polygon rings with insuffiently many points in input
|
||||||
|
|
||||||
|
# 2.37.1
|
||||||
|
|
||||||
|
* Reduce maximum memory used for vertex sorting
|
||||||
|
|
||||||
# 2.37.0
|
# 2.37.0
|
||||||
|
|
||||||
* Speed up tile-join overzooming and make it use less memory, by not including empty child tiles in the enumeration
|
* Speed up tile-join overzooming and make it use less memory, by not including empty child tiles in the enumeration
|
||||||
|
|||||||
+9
-2
@@ -644,9 +644,9 @@ drawvec fix_polygon(drawvec &geom) {
|
|||||||
|
|
||||||
// A polygon ring must contain at least three points
|
// A polygon ring must contain at least three points
|
||||||
// (and really should contain four). If this one does
|
// (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.
|
// calculate the centroid below.
|
||||||
if (j - i < 3) {
|
if (j - i < 1) {
|
||||||
i = j - 1;
|
i = j - 1;
|
||||||
outer = 0;
|
outer = 0;
|
||||||
continue;
|
continue;
|
||||||
@@ -663,6 +663,13 @@ drawvec fix_polygon(drawvec &geom) {
|
|||||||
ring.push_back(ring[0]);
|
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
|
// Reverse ring if winding order doesn't match
|
||||||
// inner/outer expectation
|
// inner/outer expectation
|
||||||
|
|
||||||
|
|||||||
@@ -2041,7 +2041,7 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
|
|||||||
vertex_readers.push_back(readers[i].vertexfile);
|
vertex_readers.push_back(readers[i].vertexfile);
|
||||||
rewind(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++) {
|
for (size_t i = 0; i < CPUS; i++) {
|
||||||
if (fclose(readers[i].vertexfile) != 0) {
|
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);
|
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++) {
|
for (size_t i = 0; i < CPUS; i++) {
|
||||||
if (fclose(readers[i].nodefile) != 0) {
|
if (fclose(readers[i].nodefile) != 0) {
|
||||||
|
|||||||
@@ -4,12 +4,16 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#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) {
|
void fqsort(std::vector<FILE *> &inputs, size_t width, int (*cmp)(const void *, const void *), FILE *out, size_t mem) {
|
||||||
std::string pivot;
|
std::string pivot;
|
||||||
FILE *fp1, *fp2;
|
FILE *fp1, *fp2;
|
||||||
|
|
||||||
|
if (mem > MAX_MEMORY) {
|
||||||
|
mem = MAX_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// read some elements into memory to choose a pivot from
|
// read some elements into memory to choose a pivot from
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -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": [
|
||||||
|
] }
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{ "type": "Feature", "properties": {}, "geometry": { "type": "LineString", "coordinates": [ [ 1, 2 ] ] } }
|
||||||
@@ -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 ] ] ] ] } }
|
||||||
@@ -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": [
|
||||||
|
] }
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
#ifndef VERSION_HPP
|
#ifndef VERSION_HPP
|
||||||
#define VERSION_HPP
|
#define VERSION_HPP
|
||||||
|
|
||||||
#define VERSION "v2.37.0"
|
#define VERSION "v2.38.0"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user