azure-maps

Azure Maps map rotation aligned label on top of extruded polygon


Is it possible to create an elevated non-rotating label on top of an extruded polygon inside Azure Maps?

For context, labels can either rotate together with the camera view (picture 1; rotation aligned with camera), or stay in the same rotation (picture 2; rotation aligned with map):

enter image description here enter image description here

A polygon can be extruded to create a 3D look:

enter image description here

Is it possible to create a symbol layer that shows a label, rotation aligned with the map (such as in the second label picture), but on top of the extruded polygon, as if the label is printed on there? For example, let's say that I create an extruded polygon of height 2 and base 0. I would then want to be able to place a label on height 2, such that it shows as if it's on top of the polygon.

I've looked at all the Azure Maps samples and didn't find such a feature, so it might not exist, or I might've looked over something.


Solution

  • For #1, there isn't a good way to do this. The closest would be to lock the rotation the map and set the pitch to the viewport in the Symbol layer options.

    {
        textOptions: {
            textField: [
                "get",
                "title"
            ],
            pitchAlignment: "viewport",
            rotationAlignment: "map"
        }
    }
    

    You might be able to get close to what you are looking for by adjusting the symbol layers rotation as the map moves.

    For #2, there is no option to set the elevation of a symbol. The closest you could do is adjust the y offset value as the maps pitch adjust.

    This is a good sample to try the different options of the symbol layer out: https://samples.azuremaps.com/symbol-layer/symbol-layer-options