Forum Discussion

aboge's avatar
aboge
Frequent Visitor
2 years ago

Azure Map zoom lock.

Hi,

I am using the Azyre Maps, I need to lock the Map for certain region like North America, How can I achieve this?

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi aboge ,

    First of all, I create a Azure Maps Visualization in Power BI Desktop.

    I think you can use maxBounds to limit the center and zoom level of the map, and minZoom, maxZoom to lock the zoom level. Here's a string of code you can refer to:

    var map = new atlas.Map('myMap', {
        center: [-101.17, 49.25], // Center on North America
        zoom: 3, // Zoom level to encompass North America
        maxBounds: [
            [-168.97, 5.96], // Southwest corner of the bounding box
            [-50.36, 83.62]  // Northeast corner of the bounding box
        ],
        minZoom: 3,
        maxZoom: 3,
        authOptions: {
            authType: 'subscriptionKey',
            subscriptionKey: '<Your Azure Maps Subscription Key>'
        }
    });

    I think this document may help you more: Get started with Azure Maps Power BI visual - Microsoft Azure Maps | Microsoft Learn

    Also I think you can use bookmark to instantly target an area.

     

     

     

    Best Regards

    Yilong Zhou

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.