diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index d50aac1c0..749c45c4c 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -149,6 +149,7 @@ public: AnnotationIDs getPointAnnotationsInBounds(const LatLngBounds&); + style::Layer* getLayer(const std::string& layerID); void addLayer(std::unique_ptr, const optional& beforeLayerID = {}); void removeLayer(const std::string& layerID); diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index 2b39b3e88..ae9330aba 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -736,6 +736,10 @@ std::vector Map::queryRenderedFeatures(const ScreenBox& box, const opti #pragma mark - Style API +style::Layer* Map::getLayer(const std::string& layerID) { + return impl->style ? impl->style->getLayer(layerID) : nullptr; +} + void Map::addLayer(std::unique_ptr layer, const optional& before) { impl->view.activate();