Skip to main content

Notifications

Community site session details

Community site session details

Session Id : n5leyiL9DEUZpQERmtRoMl
Power Apps - Building Power Apps
Unanswered

MAP: Find a street address using lat/long

Like (0) ShareShare
ReportReport
Posted on 7 Nov 2023 20:51:17 by 305

Is it possible to pass a lat/long to an address input control to find street addresses?

 

So, no user input, just click on the map, pass in the selected lat/long and return nearby addresses.

 

Or, omit the address input control is there a method to use lat/long to get neaby street addresses?

 

Categories:
  • MudassarSZ365 Profile Picture
    591 on 08 Nov 2023 at 13:42:17
    Re: MAP: Find a street address using lat/long

    @STS1SS ,

    Use a Label to Display the Address: After you get the address from the geocoding API, you could set it to a variable and then use a Label control to display it.

    // Call the API and store the response in a variable
    Set(addressResponse, YourFunctionToCallAPI(apiURL));
    
    // Assuming your response has the address in a property named 'formatted_address'
    Set(address, addressResponse.results[0].formatted_address);

    In the Label control:

    Text: address

    Use a Text Input to Display the Address: If you want to allow users to edit the address after it's been fetched, you can use a Text input control instead of a Label.

    In the Text input control:

    Default: address

    Kindly mark the solution as accepted if it resolves your issue.

    Best Regards
    Muhammad Mudassar Mazhar

     

  • STS1SS Profile Picture
    305 on 08 Nov 2023 at 13:33:03
    Re: MAP: Find a street address using lat/long

    Thanks for the reply, but the Address Input TB doesn't have a text property, or an equivalent property, from what I can see. 

  • MudassarSZ365 Profile Picture
    591 on 07 Nov 2023 at 21:45:16
    Re: MAP: Find a street address using lat/long

    Hi @STS1SS ,

    Yes, it is indeed possible to find a street address from a latitude and longitude
    Choose a Service that Offers Reverse Geocoding: Services like Bing Maps, Google Maps, and Azure Maps offer APIs for reverse geocoding.

    Set Up the API: Obtain an API key from your chosen service provider and understand the API limits and cost implications.

    PowerApps Integration: In PowerApps, you can use a custom connector or HTTP action in Power Automate to call the API service.

    Call the API: When a user clicks on a map or you otherwise obtain a latitude and longitude, make an API request to the reverse geocoding service, passing the latitude and longitude as parameters.

    For example, using Google Maps Geocoding API, an HTTP request to find an address would look like this:

    GET https://maps.googleapis.com/maps/api/geocode/json?latlng={latitude},{longitude}&key=YOUR_API_KEY

    Handle the Response: The API will return a JSON response with the address information. Parse this JSON to extract the street address and display it in your app.

    User Interface: In PowerApps, you might have a label or text input control where you can set the text property to the address returned by the API.

    Here's a conceptual example of setting up an API call within PowerApps:

    // Assume you have latitude and longitude in variables lat and long
    // Set up the API endpoint URL
    Set(apiURL, Concatenate("https://maps.googleapis.com/maps/api/geocode/json?latlng=", lat, ",", long, "&key=YOUR_API_KEY"));
    
    // Make the API call
    ClearCollect(collectedAddress, JSON(YourHTTPFunctionToCallAPI(apiURL),JSONFormat.IncludeBinaryData));
    
    // Now collectedAddress has the data returned by the API
    // You can extract the address from here and set it to a label's text property
    Set(address, First(collectedAddress).results[0].formatted_address);

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 44 Most Valuable Professional

#2
mmbr1606 Profile Picture

mmbr1606 41 Super User 2025 Season 1

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 36

Overall leaderboard
Loading started