Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Map control: center on a location

(0) ShareShare
ReportReport
Posted on by 291

Is there a method to center the map on a lat/long?

 

I'm referring to the standard map control.

 

I want to allow the map to center on a pin or a resolved address or a lat/long.

 

I thought I'd be able to easily re-center the map... I'm starting to wonder if this is just wrong.

Categories:
  • CD00131 Profile Picture
    42 on at
    Re: Map control: center on a location

    I wanted to bump the Question if that's possible. I also wonder how this simple function works since I can't get it done.

  • STS1SS Profile Picture
    291 on at
    Re: Map control: center on a location

    Thanks for the input.

     

    To be sure I was clear, I am just trying to center map on demand.

     

    EG: On initialization map centers on the default location. The desired behavior is: User selects an item in a gallery and the map centers on that location. I couldn't get that to happen,

     

    Ultimately I ended up passing in the location as the default and this is working, but frankly it is not what I want or need. I like the feature that the default location is that pulsing dot, it is just aesthetically nice.

     

    Anyway, it seems like a very basic need: center the map on demand, whether that is an event or a gallery selection or whatever.

     

    Thanks

  • MudassarSZ365 Profile Picture
    591 on at
    Re: Map control: center on a location

    @STS1SS ,

    You may use a formula to update these properties dynamically based on a pin or address you want to center on. Here's a general approach on how to do it:

    1. Set the Latitude property of the map control to the latitude of your pin or resolved address.
    2. Set the Longitude property of the map control to the longitude of your pin or resolved address.
    3. Optionally, adjust the Zoom property to get the desired level of zoom on the pin or address.

    The exact properties might be named slightly differently in the Power Apps map control, but the above steps provide a basic framework for how to set the map's center.

    If you can't find these properties directly in the map control, look for a data source or an item property of the map that might hold the latitude and longitude values. You would typically bind these properties to a context variable or a collection that holds your coordinates.

    If you think my solution is helpful for you, then please accept it. 

     

     Regards, Muhammad Mudassar Mazhar.

  • STS1SS Profile Picture
    291 on at
    Re: Map control: center on a location

    I understand there 'should' be a method, I am just not finding anything. I did find some suggestions EG: us the "Center" property, but there is no center property. I am using the Map control available in power apps under INSERT >>> MEDIA >>> MAP.

     

    STS1SS_0-1699630181572.png

     

  • MudassarSZ365 Profile Picture
    591 on at
    Re: Map control: center on a location

    Hi @STS1SS ,

    To center a map on a specific latitude and longitude, you typically use a method provided by the map control's API. For instance, if you're using Google Maps, you'd use the setCenter() method, passing in a location object with the desired latitude and longitude. This allows the map to re-center on a pin, a resolved address, or specific coordinates. The exact method might vary slightly depending on the map service you're using, but the concept remains the same: provide the coordinates to a function that sets the map's center.

    If you think my solution is helpful for you, then please accept it. 😊 Regards, Muhammad Mudassar Mazhar.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard