Skip to main content

Notifications

Community site session details

Community site session details

Session Id : /g6EMTh3WcrYDHds8XAb2d
Power Apps - Building Power Apps
Answered

Google Maps draw line between coordinates

Like (0) ShareShare
ReportReport
Posted on 6 May 2020 12:28:16 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

 

  • v-siky-msft Profile Picture
    on 13 May 2020 at 06:09:27
    Re: Google Maps draw line between coordinates

    Hi @Anonymous ,

     

    Update: You can specify up to 25 waypoints for a route.  Reference: Calculate a Route 

    However, I don't have any ideas to resolve this limitation. Maybe you can ask from BingMap community or seek assistance from Microsoft Support Ticket.

    Hope this helpss.

    Sik

  • Community Power Platform Member Profile Picture
    on 12 May 2020 at 13:32:11
    Re: Google Maps draw line between coordinates

    @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!

  • Verified answer
    v-siky-msft Profile Picture
    on 12 May 2020 at 02:38:57
    Re: Google Maps draw line between coordinates

    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 11 May 2020 at 19:46:56
    Re: Google Maps draw line between coordinates

    @v-siky-msft 

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

    map89.png

  • Community Power Platform Member Profile Picture
    on 11 May 2020 at 13:02:50
    Re: Google Maps draw line between coordinates

    @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

  • v-siky-msft Profile Picture
    on 11 May 2020 at 02:17:09
    Re: Google Maps draw line between coordinates

    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 08 May 2020 at 14:54:04
    Re: Google Maps draw line between coordinates

    @v-siky-msft 

     

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

     

    map55.png

  • Community Power Platform Member Profile Picture
    on 08 May 2020 at 14:50:30
    Re: Google Maps draw line between coordinates

    @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

  • v-siky-msft Profile Picture
    on 08 May 2020 at 03:35:39
    Re: Google Maps draw line between coordinates

    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 07 May 2020 at 13:27:58
    Re: Google Maps draw line between coordinates

    @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!

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!

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,668 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard