Project-OSRM / osrm-frontend

Modular rewrite of the OSRM frontend using LRM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adding waypoints

Hard-Loader opened this issue · comments

With a freshly loaded osrm-frontend, clicking on the map sets the start marker and a second click sets the end marker.

Subsequent clicks always update the second waypoint, whether or not extra waypoint spaces have been added or selected. This does not seem like expected behaviour. I would expect each subsequent click to add a marker after the currently selected list entry.

Is this something that might be changed in future?

I am currently testing a script that inserts routes into the map by repeatedly calling the addWaypoint() function. This only works for the start and end points, for the reasons above. Is there a workaround that would allow each point to be assigned in order to the list?

I've taken a closer look at what's going on. It's an easy change to make new markers add to the list rather than over-writing the last value. Line 204 in /src/index.js currently reads as "if (length === 1) length = length + 1;" changing that to "if (length > 0) length = length + 1;" will add a new entry for each click on the map.

I think that's more intuitive behaviour than the way it works at the moment.

Subsequent clicks always update the second waypoint, whether or not extra waypoint spaces have been added or selected. This does not seem like expected behaviour. I would expect each subsequent click to add a marker after the currently selected list entry.

I agree, this does feel unintuitive. Your suggestion makes sense to me.

Note: if you copy and paste another address and enter it into an empty via point and press enter you can add more than a stop and start. Very odd but it is what it is.

I think the main intended "work flow" for via points is dragging the route. But it makes sense to just add waypoints with each click.