[OSRM-talk] URL parameters for http://map.project-osrm.org - supporting end point only?

MapsMarker.com info at mapsmarker.com
Wed Nov 11 17:47:03 UTC 2015


Hello,

I am the developer of the WordPress mapping plugins Leaflet Maps Marker
(https://wordpress.org/plugins/leaflet-maps-marker/) and Maps Marker Pro
(https://www.mapsmarker.com). Both plugins include support for different
directions providers - one of them is OSRM and directions links are linking
directly to map.project-osrm.org <http://map.project-osrm.org> . I noticed
that the URL schema I used so far seemed to have changed and the map is now
always centered on Washington (example link produced by my plugin currently:
http://map.project-osrm.org/?hl=en
<http://map.project-osrm.org/?hl=en&loc=48.292787,16.092911&df=0>
&loc=48.292787,16.092911&df=0)

I did some research and found that the URL parameters have changed and that
new parameters like "center" are required.

Anyway I am having issues supporting the new URL scheme, because I only want
to set the end point for directions as I do not know where the user wants to
start. I tried this by using the following URL for example:
http://map.project-osrm.org/?z=13
<http://map.project-osrm.org/?z=13&center=48.242330%2C16.433030&loc=48.24233
0%2C16.433030&loc=&hl=en&ly=&alt=&df=&srv=>
&center=48.242330%2C16.433030&loc=48.242330%2C16.433030&loc=&hl=en&ly=&alt=&
df=&srv=

The main issue is that if only 1 loc parameter is set, the input form field
for start point remains empty, resulting in a non usable link for my plugin
users.

The current workaround for this issue is to set both loc parameters to the
same lat+lon values (like http://map.project-osrm.org/?z=13
<http://map.project-osrm.org/?z=13&center=48.242330%2C16.433030&loc=48.24233
0%2C16.433030&loc=48.242330%2C16.433030&hl=en&ly=&alt=&df=&srv=>
&center=48.242330%2C16.433030&loc=48.242330%2C16.433030&loc=48.242330%2C16.4
33030&hl=en&ly=&alt=&df=&srv=) - this results in start+end point form fields
being populated - anyway this is suboptimal, as the user has to delete the
start form field and enter where he wants to start.

I searched the wiki but couldnt find a way how this could be solved. Is
there a way to use a URL like http://map.project-osrm.org/?z=13
<http://map.project-osrm.org/?z=13&center=48.242330%2C16.433030&loc=48.24233
0%2C16.433030&loc=&hl=en&ly=&alt=&df=&srv=>
&center=48.242330%2C16.433030&loc=48.242330%2C16.433030&loc=&hl=en&ly=&alt=&
df=&srv= with only 1 loc parameter set which prefills the endpoint for
directions so that the user only has to set the start point for directions?
If not, is there a chance that the site gets updated to support that?

Any help would really be appreciated!

best,

Robert

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/osrm-talk/attachments/20151111/3dea4565/attachment.html>


More information about the OSRM-talk mailing list