From 9573adff03470c45762f04b335b7245d112c5fc3 Mon Sep 17 00:00:00 2001 From: Vladyslav Odobesku Date: Wed, 9 Apr 2025 19:19:20 +0300 Subject: [PATCH] Fix corner case when clipped line ends can have very low simplification factor thus important parts of a line can be dropped in the last step of conversion to vector tile. --- include/mapbox/geojsonvt/clip.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/mapbox/geojsonvt/clip.hpp b/include/mapbox/geojsonvt/clip.hpp index 881ef16..f57ae1b 100644 --- a/include/mapbox/geojsonvt/clip.hpp +++ b/include/mapbox/geojsonvt/clip.hpp @@ -195,6 +195,13 @@ class clipper { if (lineMetrics) slice.segEnd = lineLen; slices.emplace_back(std::move(slice)); } + + for (auto& current_sice : slices) { + if (current_sice.size() > 2) { + current_sice[0].z = 1.0; + current_sice[current_sice.size() - 1].z = 1.0; + } + } } vt_linear_ring clipRing(const vt_linear_ring& ring) const {