web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Google Maps draw line ...
Power Apps
Answered

Google Maps draw line between coordinates

(0) ShareShare
ReportReport
Posted on by

I am using the Google Maps Static Map API and am able to plot multiple coordinates on my map based on a SQL table with columns for Latitude and Longitude. However, I cannot get the PATH parameter to work. Does anyone know how to use the PATH parameter correctly. I have spent a lot of time reading through Google documentation without any luck. Here is what I have:

map33.png

 

Categories:
I have the same question (0)
  • v-siky-msft Profile Picture
    on at

    Hi @Anonymous ,

     

    I couldn't test the Google maps API because it seemed to require a billing account, but I've worked on the Bing map API with the same requirements you mentioned.

    If you have insterst in Bing Map API, please take reference on this thread or this document.

    Snipaste_2020-05-07_15-22-45.pngHope this helps.

    Sik

  • Community Power Platform Member Profile Picture
    on at

    @v-siky-msft 

     

    Thanks for all the info and documentation on Bing Maps. I have no issue using either Bing or Google; just a map that I can show routes on. I was able to get the example Bing Map to work with a route using the following code in PowerApps:

    "https://dev.virtualearth.net/REST/v1/Imagery/Map/Road/Routes?wp.0=Seattle,WA;64;1&wp.1=Redmond,WA;66;2&key=AvacKoSiQEeqiuHzDBQYYyM_8fDhCS09zNgg0Zvz66MNExvjuTasagOFUn_gDBdM"

     

    I am just not sure how to combine the custom PowerApps formula into the above Bing formula. Here is my formula Google map in PowerApps with all my coordinates plotted on the map:

    "https://maps.googleapis.com/maps/api/staticmap?center= " & First(colTrucks).Latitude & "," & First(colTrucks).Longitude & "&zoom="&Slider1.Value&"&size=1340x404&key=AIzaSyB6H-z3ikRFI3RseejUY1YHf9C0_OFSFnw"&Concat(colTrucks,"&markers=size:tiny%7Ccolor:red%7Clabel:%7C" & Latitude & "," & Longitude & "&path=weight:3|color:blue" & Latitude & "," & Longitude)

     

    Any idea how to get the Lat and Longs to work with Bing? Thank you!

  • v-siky-msft Profile Picture
    on at

    Hi @Anonymous ,

     

    So there is a table colTrucks with Latitude and Longitude column, right?

    First, please try this code to add the Row Numbers for each row of colTrucks.

     

    Clear(colNumberedTrucks);
    ForAll(colTrucks, 
     Collect(colNumberedTrucks,
     Last(FirstN(AddColumns(colTrucks,
     "RowNumber",
     CountRows(colNumberedTrucks)+1
     ), 
     CountRows(colNumberedTrucks)+1
     )
     ) 
     )
    )

     

    Then, please try this:

     

    "https://dev.virtualearth.net/REST/v1/Imagery/Map/Road/Routes?"& Concat(colNumberedTrucks,"wp."& RowNumber & "=" & Latitude &","&Longitude&";66;" &RowNumber&"&") &"key="&txtBingMapsKey.Text

     

    Snipaste_2020-05-08_11-32-44.png

    Hope this helps.

    Sik

  • Community Power Platform Member Profile Picture
    on at

    @v-siky-msft 

     

    Thank you for all your help. I tried what you said and not getting any data on my Map image. I do have data in the Collection though so not sure why it isnt showing up on Map.

    map33.pngmap44.png

  • Community Power Platform Member Profile Picture
    on at

    @v-siky-msft 

     

    Sorry, forgot to attach this image showing the data is in the Collection by using DataTable.

     

    map55.png

  • v-siky-msft Profile Picture
    on at

    Hi @Anonymous ,

     

    Could you please show the parsed URL by a Label shown as below?

    Snipaste_2020-05-11_10-05-53.png

    How many waypoints do you want to display?

    So far, the possible reason is that the RowNumber doesn't start at 1, since seemly the waypoints are from 58-70 shown in your DataTable. RowNumbers are the index of each waypoint in the URL, it must start at 1 and gradually increase for other waypoints, as shown below.

     

    https://dev.virtualearth.net/REST/v1/Imagery/Map/Road/Routes?wp.1=Seattle,WA;64;1&wp.2=Redmond,WA;66;2&key={BingMapsAPIKey}

     

    Of course, in order to debug the problem accurately, please provide the parsed URL.  you can also follow the example above to determine where your URL is wrong.

    Thanks.

    Sik

  • Community Power Platform Member Profile Picture
    on at

    @v-siky-msft 

     

    I was able to get the line to print, however, sometimes the line and coordinates do not show up on Map. Is there a limit to the number of plots that can show on the map? It seems to not work when I have a lot of plots. Also, do you know how to incorporate Zoom with using a Slider control for BING maps? Thanks!map77.png

  • Community Power Platform Member Profile Picture
    on at

    @v-siky-msft 

    Here is what I tried for the Zoom using Slider control but it doesn't work.

    map89.png

  • Verified answer
    v-siky-msft Profile Picture
    on at

    Hi @Anonymous ,

     

    Yes, there is a limitation that you can specify up to 18 pushpins in the URL.

    To achieve Zoom in/out function, you need to define a center point  and a Zoom level after the Road before Route.

    Sample: https://docs.microsoft.com/en-us/bingmaps/rest-services/imagery/get-a-static-map#get-a-map-with-road-imagery-centered-at-a-point-with-a-specified-zoom-level 

    Snipaste_2020-05-12_10-30-47.png

    In your case, please try this, set the first point to center point, use slider control to control the zoom level.

    "https://dev.virtualearth.net/REST/v1/Imagery/Map/Road/"&First(colNumberedTrucks).Latitude&","& First(colNumberedTrucks).Longitude&"/"&Slider1.Value&"/Routes?"& Concat(colNumberedTrucks,"wp."& RowNumber & "=" & Latitude &","&Longitude&";66;" &RowNumber&"&") &"key={BingMapsAPIKey}"
    

      GIF_72.gif

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    Hope this helps.

    Sik

     

     

     

     

     

     

  • Community Power Platform Member Profile Picture
    on at

    @v-siky-msft 

     

    This is all working for me now with the Zoom and also the line between coordinates. The only issue I am having now is the limit to 18 pushpins. When some of the routes our drivers have more than 18 lat/long coordinates. Sometimes as high as 40-50 in a given day. Any suggestions on how to handle that? Thanks for all your assistance so far, it has been great!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard