Merge any leftover feature remnants onto some feature.

Add a test for coalescing small features onto large ones.
This commit is contained in:
Eric Fischer 2017-10-09 17:14:32 -07:00
parent 748ef3b1d5
commit 91e469aac2
4 changed files with 6817 additions and 2 deletions

@ -1,3 +1,8 @@
## 1.25.0
* Add --coalesce-smallest-as-needed strategy for reducing tile sizes
* Add --stats option to tipppecanoe-decode
## 1.24.1
* Limit the size and depth of the string pool for better performance

File diff suppressed because one or more lines are too long

@ -1575,7 +1575,7 @@ long long write_tile(FILE *geoms, long long *geompos_in, char *metabase, char *s
if (coalesced_geometry.size() != 0) {
for (ssize_t i = coalesced_geometry.size() - 1; i >= 0; i--) {
if (coalesced_geometry[i].t == sf.t) {
if (coalesced_geometry[i].t == sf.t && coalesced_geometry[i].layer == sf.layer) {
for (size_t j = 0; j < coalesced_geometry[i].geometry.size(); j++) {
sf.geometry.push_back(coalesced_geometry[i].geometry[j]);
}
@ -1639,6 +1639,20 @@ long long write_tile(FILE *geoms, long long *geompos_in, char *metabase, char *s
merge_previndex = sf.index;
}
// Attach any pieces that were waiting to be coalesced onto some features that did make it.
for (ssize_t i = coalesced_geometry.size() - 1; i >= 0; i--) {
for (size_t j = 0; j < partials.size(); j++) {
if (partials[j].layer == coalesced_geometry[i].layer && partials[j].t == coalesced_geometry[i].t) {
for (size_t k = 0; k < coalesced_geometry[i].geometry.size(); k++) {
partials[j].geoms[0].push_back(coalesced_geometry[i].geometry[k]);
}
coalesced_geometry.erase(coalesced_geometry.begin() + i);
break;
}
}
}
if (prefilter != NULL) {
json_end(prefilter_jp);
if (fclose(prefilter_read_fp) != 0) {

@ -1,6 +1,6 @@
#ifndef VERSION_HPP
#define VERSION_HPP
#define VERSION "tippecanoe v1.24.1\n"
#define VERSION "tippecanoe v1.25.0\n"
#endif