Can anyone show a small example of getting turn by turn navigation from the enhanced MAP component? I see there is output events and output object as described on this page: Calculate routes between waypoint pins on a map (preview) - Power Apps | Microsoft Learn, so I put this in my OnRouteDirectionChange event handler:
ClearCollect(colRouteDirection,map_Routes.RouteDirection);
ClearCollect(colRouteLegs,map_Routes.RouteDirection.RouteLegs); ClearCollect(colOrderedWayPoints,map_Routes.RouteDirection.OrderedWaypoints)
So now, with input from 2 address controls (the starting address and the ending address), the component draws the map with the route showing on it in blue, and my 3 collections contain information. My colRouteDirection object includes a RouteGeoJSON field that itself is some type of json that is a string that describes the route in GeoJSON format. My colRouteLegs is documented as: A table that describes each leg of the route (but for a given starting address and ending address, I only get 1 entry in the colRouteLegs). (Can someone show me how to turn RouteDirection.RouteGeoJSON text into it's own collection of items also?)
I asked Bing with ChatGPT/AI how to do it with this question: Can you give me an example in power apps code that takes a RouteDirection object from the Maps component and creates a collection called colTurnByTurnDirections of turn by turn navigation items?
And it returned some non-workable code with this:
ClearCollect(colTurnByTurnDirections, Map1.RouteDirection.Routes[0].Legs[0].Maneuvers)
(I say it's non-workable because the RouteDirection object doesn't have an array of Routes in it, and there is no Routes.Legs or Routes.Legs.Maneuvers in there). (and yes, I changed Map1 to match the name of my component instances which was map_Routes.
I've attached my app as an .msapp file that includes a gallery where I had hoped to bind a collection of turn by turn directions to, but I can't even figure out where the turn by turn information might be. If I need to make some other function call to retrieve the turn by turn I will, but ultimately, I want to show turn by turn nav for any two points on my map. Just like Bing and Google maps can do.
Can anyone help me by telling me what needs to be done to get turn by turn into my app.
1. Take the DirectDirections.msapp and import as a canvas app into your environment that has the Spatial Services turned on/Full Map service turned on)
2. Run it. Put in any two addresses in the two input address fields. As soon as the map appears, stop the app and look at the collections. They will each hold something, but none of them have anything approaching turn by turn directions, although the RouteGeoJSON text item from the RouteDirection object holds a string representing a multiline set of locations drawn as some type of geometry multiline coordinates..
Someone suggested that Bing's AI integration couldn't give me a correct example because it was based on the Azure Map component not the new one in Power Apps, which is why the object layout may be wrong.
Maybe it cannot do it on it's own and i have to call something else to get turn by turn. But as a Premium component, I would hope it's contained in the enhanced Power Apps Map component output variables somewhere.

Report
All responses (
Answers (