diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b2e2ec..ce7b61d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.4.2 + +* Bug fix for problem that would occasionally produce empty point geometries +* More bug fixes for polygon generation + ## 1.4.1 * Features that cross the antimeridian are split into two parts instead diff --git a/geometry.cc b/geometry.cc index 36ba691..ce30af2 100644 --- a/geometry.cc +++ b/geometry.cc @@ -108,27 +108,29 @@ drawvec remove_noop(drawvec geom, int type, int shift) { // second pass: remove unused movetos - geom = out; - out.resize(0); + if (type != VT_POINT) { + geom = out; + out.resize(0); - for (i = 0; i < geom.size(); i++) { - if (geom[i].op == VT_MOVETO) { - if (i + 1 >= geom.size()) { - continue; + for (i = 0; i < geom.size(); i++) { + if (geom[i].op == VT_MOVETO) { + if (i + 1 >= geom.size()) { + continue; + } + + if (geom[i + 1].op == VT_MOVETO) { + continue; + } + + if (geom[i + 1].op == VT_CLOSEPATH) { + fprintf(stderr, "Shouldn't happen\n"); + i++; // also remove unused closepath + continue; + } } - if (geom[i + 1].op == VT_MOVETO) { - continue; - } - - if (geom[i + 1].op == VT_CLOSEPATH) { - fprintf(stderr, "Shouldn't happen\n"); - i++; // also remove unused closepath - continue; - } + out.push_back(geom[i]); } - - out.push_back(geom[i]); } // second pass: remove empty movetos diff --git a/tile.cc b/tile.cc index b21e6b0..93f5273 100644 --- a/tile.cc +++ b/tile.cc @@ -753,12 +753,18 @@ long long write_tile(char **geoms, char *metabase, char *stringpool, int z, unsi } features[j] = out; + out.clear(); for (x = 0; x < features[j].size(); x++) { if (features[j][x].coalesced && features[j][x].type == VT_LINE) { features[j][x].geom = remove_noop(features[j][x].geom, features[j][x].type, 0); features[j][x].geom = simplify_lines(features[j][x].geom, 32, 0); } + + if (features[j][x].geom.size() > 0) { + out.push_back(features[j][x]); + } } + features[j] = out; if (prevent['i' & 0xFF]) { std::sort(features[j].begin(), features[j].end(), preservecmp); diff --git a/version.h b/version.h index 5c66f11..bcab1a6 100644 --- a/version.h +++ b/version.h @@ -1 +1 @@ -#define VERSION "tippecanoe v1.4.1\n" +#define VERSION "tippecanoe v1.4.2\n"