Azure maps, drawing toolbar - add a custom button

Dev 216 Reputation points
2021-11-12T09:06:21.99+00:00

Is it possible to add a custom button to the drawingToolbar, something like

            const buttons = ["draw-polygon", "draw-rectangle", "draw-circle", "edit-geometry", "erase-geometry", "my-custom-button"];
            drawingToolbar.setOptions({
                buttons: buttons,
                position: "top-right",
                style: "light"
            });

And then set the icon & onClick event?

Azure Maps
Azure Maps
An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
339 questions
No comments
{count} votes

Accepted answer
  1. rbrundritt 7,011 Reputation points Microsoft Employee
    2021-11-17T03:52:26.253+00:00

    I swear I responded to this yesterday. I must have closed my browser before pressing send.

    In any case, there is no built in support for adding custom buttons directly into the toolbar. However you can create a custom button and either float if above the map next to the toolbar (position absolute...), or use the custom control framework for the map.

    Here is a simple example that adds buttons above the map: https://azuremapscodesamples.azurewebsites.net/?sample=Custom%20navigation%20controls

    There are many examples of custom controls for Azure Maps here: https://github.com/microsoft/Maps/blob/master/AzureMaps.md

    No comments

0 additional answers

Sort by: Most helpful