Once features can't possibly fit in a tile, stop trying (#9)

* Stop adding features to a tile if it can't possibly work

* Add --integer and --fraction options to tippecanoe-decode

* Carry the strategies field from tileset metadata through tile-join

* Update changelog

* Assign different codes to different kinds of error exits
This commit is contained in:
Erica Fischer
2022-09-23 20:01:13 -04:00
committed by GitHub
parent ed31b9ac84
commit af1a7ed7ae
44 changed files with 782 additions and 488 deletions
+8 -7
View File
@@ -14,6 +14,7 @@
#include "milo/dtoa_milo.h"
#include "jsonpull/jsonpull.h"
#include "text.hpp"
#include "errors.hpp"
#define POINT 0
#define MULTIPOINT 1
@@ -37,7 +38,7 @@ static std::vector<queued_feature> feature_queue;
void ensureDim(size_t dim) {
if (dim < 2) {
fprintf(stderr, "Geometry has fewer than 2 dimensions: %zu\n", dim);
exit(EXIT_FAILURE);
exit(EXIT_IMPOSSIBLE);
}
}
@@ -117,7 +118,7 @@ drawvec readLinePart(std::vector<long long> &coords, size_t dim, double e, size_
for (size_t i = start; i + dim - 1 < end; i += dim) {
if (i + dim - 1 >= coords.size()) {
fprintf(stderr, "Internal error: line segment %zu vs %zu\n", i + dim - 1, coords.size());
exit(EXIT_FAILURE);
exit(EXIT_IMPOSSIBLE);
}
for (size_t d = 0; d < dim; d++) {
@@ -328,12 +329,12 @@ void readFeature(protozero::pbf_reader &pbf, size_t dim, double e, std::vector<s
for (size_t i = 0; i + 1 < properties.size(); i += 2) {
if (properties[i] >= keys.size()) {
fprintf(stderr, "Out of bounds key: %zu in %zu\n", properties[i], keys.size());
exit(EXIT_FAILURE);
exit(EXIT_IMPOSSIBLE);
}
if (properties[i + 1] >= values.size()) {
fprintf(stderr, "Out of bounds value: %zu in %zu\n", properties[i + 1], values.size());
exit(EXIT_FAILURE);
exit(EXIT_IMPOSSIBLE);
}
full_keys.push_back(keys[properties[i]]);
@@ -354,12 +355,12 @@ void readFeature(protozero::pbf_reader &pbf, size_t dim, double e, std::vector<s
for (size_t i = 0; i + 1 < misc.size(); i += 2) {
if (misc[i] >= keys.size()) {
fprintf(stderr, "Out of bounds key: %zu in %zu\n", misc[i], keys.size());
exit(EXIT_FAILURE);
exit(EXIT_IMPOSSIBLE);
}
if (misc[i + 1] >= values.size()) {
fprintf(stderr, "Out of bounds value: %zu in %zu\n", misc[i + 1], values.size());
exit(EXIT_FAILURE);
exit(EXIT_IMPOSSIBLE);
}
other.insert(std::pair<std::string, serial_val>(keys[misc[i]], values[misc[i + 1]]));
@@ -466,7 +467,7 @@ void runQueue() {
for (size_t i = 0; i < CPUS; i++) {
if (pthread_create(&pthreads[i], NULL, run_parse_feature, &qra[i]) != 0) {
perror("pthread_create");
exit(EXIT_FAILURE);
exit(EXIT_PTHREAD);
}
}