diff --git a/serial.cpp b/serial.cpp index 5cbafec9..95a55bdd 100644 --- a/serial.cpp +++ b/serial.cpp @@ -775,8 +775,12 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf, std:: preserve_multiplier_density_threshold > 0 || cluster_distance != 0) { sf.index = bbox_index; + sf.wx = midx; + sf.wy = midy; } else { sf.index = 0; + sf.wx = 0; + sf.wy = 0; } if (sst->layermap->count(layername) == 0) { diff --git a/tile.cpp b/tile.cpp index 1d531e58..6c4ceaf0 100644 --- a/tile.cpp +++ b/tile.cpp @@ -1059,6 +1059,7 @@ static bool skip_next_feature(decompressor *geoms, std::atomic *geomp struct next_feature_state { unsigned long long previndex = 0; + unsigned prevx = 0, prevy = 0; unsigned long long prev_not_dropped_index = 0; }; @@ -1128,8 +1129,8 @@ static serial_feature next_feature(decompressor *geoms, std::atomic * long long ox = (1LL << (32 - z)) * tx; long long oy = (1LL << (32 - z)) * ty; - unsigned wx1, wy1; - decode_index(next_feature_state.previndex, &wx1, &wy1); + unsigned wx1 = next_feature_state.prevx; + unsigned wy1 = next_feature_state.prevy; // find the furthest distance of a vertex in this feature // from the representative point of the previous feature @@ -1145,6 +1146,8 @@ static serial_feature next_feature(decompressor *geoms, std::atomic * } } next_feature_state.previndex = sf.index; + next_feature_state.prevx = sf.wx; + next_feature_state.prevy = sf.wy; if (clip_to_tile(sf, z, buffer)) { continue;