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.
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.
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
@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:
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.
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.
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.
WarrenBelz
146,524
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,906
Most Valuable Professional