We develop an airport App using the Web JS SDK. We already have a path from the current geolocation to the gate, this path can have several nodes/waypoints in between such as a shop and a security check. Is it possible to have a user experience with Mappedin like you have with a car navigation system? Like you start the navigation and the path is followed automatically using the BlueDot, even removing nodes when they have been passed during walking? If this is not possible to do automatically with Mappedin, how do we redraw the path manually, for example how can we programmatically know that the user has passed a waypoint on his way (to remove the particular node/waypoint from the route then) such as a shop or security check?
The path does not automatically redraw when the Blue Dot moves. If this is something you wish to do in your app, it will need to get directions again, remove the old path and add a new one. This is what we do with Mappedin Web. I recommend against doing this with every blue dot update or else it gets distracting for the user. Updating the path every 3-6 seconds often works best.
As for knowing when the user passes a specific location, you could keep a copy of the previous directions and compare it to the new directions from the user’s updated location. That way you can track as steps are removed.
Thank you for your answer. You say, in order to know if a waypoint was crossed I should compare the previous directions with the current directions. I don’t understand how to do this, since the current directions would still go through the previous waypoint. How should I know that the waypoint was crossed? It seems to be very complicated to do and mappedin is not designed to do this task or am I wrong?
When creating directions and using Blue Dot, the start location for the directions should be the coordinates of the user’s position (used to show the blue dot). Since this start position is changing, the first (or possibly more depending on update frequency) the number of steps in the destination instructions will be reduced because they’re closer to their destination. The original directions could be:
-
Walk straight 4 meters.
-
Pass through security.
-
Turn right and proceed 10 meters.
-
etc…
Then, after the user has passed through security and you call getDirections again the direction instructions will be different:
-
Turn right and proceed 10 meters.
-
etc…
Typically apps don’t track what steps the user has completed, but instead just show the steps the user needs to complete. What is the use case for keeping track of the completed steps?
I don’t know if the above you have shown is correct. Just because you have crossed the security check does not mean you are at turn right and proceed 10 meters. It would rather show you the way back to the security check because you still have the waypoint of the security check in the new route. So the route will point from the new geolocation backwards to the security check and then to the gate, I might be wrong but it seems logical.
Yes you are right, it could be we decide to show only the steps and the user has to redraw the route when it is needed. The idea was to have a user experience like on Google Maps but with waypoints you want to visit in between.
When getting directions, you can provide an origin and destination and Mappedin JS will return a set of instructions to get there. If the user is after security and you get directions from their current location to the destination, the security checkpoint will not be in the list of instructions.
Or are you creating a multi destination route, where you have a origin and are passing an array of destinations to MapData.getDirections()
? For this scenario, you would need to remove destinations from your array once the user has visited that location. To do this you could reference the distance to that location in the directions. Once it reaches close to 0 you can assume the user arrived there and then remove it from your multi destination array. Alternatively, you can use the MapData.getDistance()
method to just get the distance from an origin to the destination.