cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Prodigy
Post Prodigy

Google Maps draw line between coordinates

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Hi @thunter ,

 

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... 

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

 

 

 

 

 

 

View solution in original post

11 REPLIES 11
Highlighted
Community Support
Community Support

Hi @thunter ,

 

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

Highlighted

@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..."

 

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!

Highlighted

Hi @thunter ,

 

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

Highlighted

@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

Highlighted

@v-siky-msft 

 

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

 

map55.png

Highlighted

Hi @thunter ,

 

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

Highlighted

@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

Highlighted

@v-siky-msft 

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

map89.png

Highlighted

Hi @thunter ,

 

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... 

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

 

 

 

 

 

 

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (9,736)