Skip to content

Commit

Permalink
Merge pull request #417 from mapbox/only-warn-once
Browse files Browse the repository at this point in the history
Only warn once about invalid polygon encoding in tippecanoe-decode
  • Loading branch information
e-n-f authored May 12, 2017
2 parents 7fe3de9 + 9632c14 commit 733092a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.18.1

* Only warn once about invalid polygons in tippecanoe-decode

## 1.18.0

* Fix compression of tiles in tile-join
Expand Down
24 changes: 18 additions & 6 deletions decode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,15 @@ void handle(std::string message, int z, unsigned x, unsigned y, int describe, st

if (i + 1 >= ops.size() || ops[i + 1].op == VT_MOVETO) {
if (ops[i].op != VT_CLOSEPATH) {
fprintf(stderr, "Ring does not end with closepath (ends with %d)\n", ops[i].op);
if (!force) {
exit(EXIT_FAILURE);
static bool warned = false;

if (!warned) {
fprintf(stderr, "Ring does not end with closepath (ends with %d)\n", ops[i].op);
if (!force) {
exit(EXIT_FAILURE);
}

warned = true;
}
}
}
Expand Down Expand Up @@ -307,9 +313,15 @@ void handle(std::string message, int z, unsigned x, unsigned y, int describe, st
int state = 0;
for (size_t i = 0; i < rings.size(); i++) {
if (i == 0 && areas[i] < 0) {
fprintf(stderr, "Polygon begins with an inner ring\n");
if (!force) {
exit(EXIT_FAILURE);
static bool warned = false;

if (!warned) {
fprintf(stderr, "Polygon begins with an inner ring\n");
if (!force) {
exit(EXIT_FAILURE);
}

warned = true;
}
}

Expand Down
2 changes: 1 addition & 1 deletion version.hpp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define VERSION "tippecanoe v1.18.0\n"
#define VERSION "tippecanoe v1.18.1\n"

0 comments on commit 733092a

Please sign in to comment.