From 20f880ebec82bbd7553fc382400227efc0105bce Mon Sep 17 00:00:00 2001 From: Chris Loer Date: Tue, 14 Aug 2018 11:35:39 -0700 Subject: [core] Fix querying for annotations near tile boundaries at high zoom. Fixes issue #12472. This commit doesn't address the underlying issues that come from symbolAnnotationTree using a slightly lower precision coordinate system than the annotations themselves. Instead, it just puts a small padding around each tile when it queries for tile data, so that symbols right at the tile boundary will be included in both tiles. The rendering/querying code will take care of only displaying one instance. The padding is in global coordinates, so at higher zoom the padding will be larger in tile units -- this is consistent with precision loss also being greater at higher zoom. --- src/mbgl/annotation/annotation_manager.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/mbgl') diff --git a/src/mbgl/annotation/annotation_manager.cpp b/src/mbgl/annotation/annotation_manager.cpp index 41eedf17dc..1baf83179e 100644 --- a/src/mbgl/annotation/annotation_manager.cpp +++ b/src/mbgl/annotation/annotation_manager.cpp @@ -140,7 +140,13 @@ std::unique_ptr AnnotationManager::getTileData(const Canonic auto pointLayer = tileData->addLayer(PointLayerID); LatLngBounds tileBounds(tileID); - + // Hack for https://github.com/mapbox/mapbox-gl-native/issues/12472 + // To handle precision issues, query a slightly larger area than the tile bounds + // Symbols at a border can be included in vector data for both tiles + // The rendering/querying logic will make sure the symbols show up in only one of the tiles + tileBounds.extend(LatLng(tileBounds.south() - 0.000000001, tileBounds.west() - 0.000000001)); + tileBounds.extend(LatLng(tileBounds.north() + 0.000000001, tileBounds.east() + 0.000000001)); + symbolTree.query(boost::geometry::index::intersects(tileBounds), boost::make_function_output_iterator([&](const auto& val){ val->updateLayer(tileID, *pointLayer); -- cgit v1.2.1