diff --git a/shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorSymbolGroup.cpp b/shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorSymbolGroup.cpp index deb82a0e4..c93562aa0 100644 --- a/shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorSymbolGroup.cpp +++ b/shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorSymbolGroup.cpp @@ -152,13 +152,15 @@ void Tiled2dMapVectorSymbolGroup::initialize(std::weak_ptrstyle.iconImageEvaluator.getValue()) { - // Attempt to evaluate without zoom and state - const auto zoomAndStateIndependentEvalCtx = EvaluationContext(dpFactor, context.get(), nullptr); - const auto value = layerDescription->style.iconImageEvaluator.getValue(); - const auto res = value->evaluate(zoomAndStateIndependentEvalCtx); - const std::string *iconImage = std::get_if(&res); - // if this succeeded returns empty, there is no icon image for any zoom level. - hasIconPotentially = (iconImage != nullptr && !iconImage->empty()); + const auto iconImageUsedKeys = layerDescription->style.iconImageEvaluator.getValue()->getUsedKeys(); + if (iconImageUsedKeys.isStateDependant() || + iconImageUsedKeys.containsUsedKey(ValueKeys::ZOOM)) { + hasIconPotentially = true; + } else { + // Expression independent of zoom/state, so we can evaluate to see if there is an icon for this feature. + const auto iconImage = layerDescription->style.getIconImage(evalContext); + hasIconPotentially = !iconImage.value.empty(); + } } else { hasIconPotentially = false; }