Map, navigation (waypoints)

Hi. I have a question... Is there any possibility to make more points to navigation? I know how to set start and end point, but I would like to put few intermediate points tonthe route... Is there any chance?

Welcome Michal.

Google Maps has a way of adding intermediate points on the route. These are called waypoints. Google Maps has this feature, Navigate does not although waypoints can be 'added' in a complicated way.

Using the App Inventor Tools

When you request directions using Navigate, you use ORS to generate a list of directions and a path showing the route on the Map component. Unless you provide additional coding, this happens one time. If you continually change the start location (perhaps using a LocationSensor.LocationChanged Block), but maintain the same end location, a developer can provide continuously changing directions based on new coordinates when her or his code sets the 'start location' to the current location and calls the RequestDirections.

If you you wish waypoints, try requesting directions to the first waypoint, then request directions from waypoint1 to waypoint2, then request directions from waypoint2 to final destination. Capture the directions to each waypoint as you create them. Connotate 'directions' until you get all the directions in one Label.

I did something like that using 'scrap' code and it worked. I also captured the track (points) and displayed the different segments in different colors. Sorry, I can't locate the code at the moment.

Using Google Map

See waypoints in this link Getting directions through the Directions API  |  Google for Developers It shows how to use waypoints with Google Maps directions.

Perhaps someone will have simpler solutions.

Thanks for detailed information. A think I should use Google maps rather than navigate options in ORS. My aim is to pick to points on the map( I have done it already), then ask for a path with distance. And then choose third midpoint on the map which will change original path and will count distance again.
Is it possible with using ORS or only google?

Possible using either routing option. Google will give you superior direction results.
What you do depends on your AI coding skills and whether you have a Google API developer's license.

Here is an example displaying three different route results displayed on one map. This shows four paths using ORS 1 to 2, 2 to 3 and 3 to 4 (back to 1) and some other stuff.

Try some Blocks. You probably can do what you want.

This is what i excactly need. But i stucked on two points, start and end in navigation... How did You do that? :slight_smile:
I'm adding my blocks. How should I add this next points like You did?

I used

  • a List of Coordinates for start and end for waypoints 1-3
  • 4 LineStrings
  • DoubleTapAtPoint to add the start for waypoint 4
  • these Blocks

to get a response like this.

Good luck.

Thank You for Your time. You explained everything what I need. You are Great.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.