I have two questions which are somehow related.
- I have created a route on an open street map and I want to extract a list of points that correspond to the way points of the generated route (not just the start and the finish). How can this be achieved? For example I want to extract way points for the generated red route from the image bellow (of course I do not want to extract all the points from a route but from 10 in 10 meters).
How do I erase the generated route with red, and have the original map (without the red route) I have tried many function on the map item but non of them worked. For example I have tried the code below but the red route remains.
function clearMapDataForSession() { mapview.clearData(); routeModel.update() }

You can get a list of coordinates from the
Routeby using the properties path or segments. Thepathproperty directly gives you a list ofcoordinateson the givenRoute, thesegmentsproperty on the other hand gives you a list of RouteSegments which in turn contain a list ofcoordinatesgiven by itspathproperty.Print the list of
Routecoordinates viasegments:Print the list of
Routecoordinates viapath:If you compare the list of coordinates given by the two options, they are the same. The benefit of
RouteSegmentsis that you get thedistanceof the segment as a property. So if you want to generate a list of coordinates/points on theRouteat the same distance, this would help you in writing some sort of an algorithm.In order to erase a generated
Routeyou need to callreset()on theRouteModel. If you want to also clear the waypoints of aRouteQueryyou should callclearWaypoints()as well.