Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Routing configuration should be reworked to avoid parameter order hardcoding #37

Closed
sbocahu opened this issue Oct 23, 2017 · 3 comments
Closed

Comments

@sbocahu
Copy link

sbocahu commented Oct 23, 2017

The routing module, thanks to the XML configuration module, can use other/custom routing API. However, the coordinates are hardcoded in this order: latitude,longitude. This prevents from using APIs that take as arguments coordinates in longitude,latitude format, which is the case for example of brouter.

I did not try to propose some code as a pull request as I failed to rebuild viking-gps from debian sources (something related to linking a static lib and a dynamic one, with an advice to rebuild with -fPIC... I'm not competent to deal with it !) with minor modification (simply tried to change lat,lon by lon,lat).
however, I was able to use brouter by using the following routing.xml file

<objects>
  <object class="VikRoutingWebEngine">
    <property name="id">brouter</property>
    <property name="label">brouter</property>
    <property name="format">gpx</property>
    <property name="url-base">http://h2096617.stratoserver.net:443/brouter?nogos=&amp;profile=hiking-beta&amp;alternativeidx=0&amp;format=gpx</property>
    <property name="url-start-ll">&amp;lonlats=%s,%s</property>
    <property name="url-stop-ll">|%s,%s</property>
    <property name="url-via-ll"></property>
  </object>
</objects>

and by reordering lon/lat by using a MITM "attack".

brouter with the hiking-beta profile is very efficient for creating tracks for hiking, trail running, mountain cycling... It'ld be great to add support for it !

thanks !

@rnorris
Copy link
Collaborator

rnorris commented Oct 29, 2017

Agreed, the format should be more flexible.

ATM I think the most likely (least effort to implement & therefore get done) approach will be to add an extra property along the lines of:

<property name="ll-order-lat-first">FALSE</property>

To switch the order to be lon, lat.

Thus this would keep any backwards compatibly as the default would be TRUE to use lat, lon.

Ultimately a more flexible tokenizer approach would be nice and/or a smarter way to select sub-items (e.g. being able to list/select the routing profile type [cycle/car/foot/etc...] - without having to specify the whole object class common properties each time), but unlikely to get done in the near future.

@matthewhague
Copy link

matthewhague commented May 7, 2018

The values in the xml files get passed to sprintf, iirc. I've gotten away with using

lonlats=%2$s,%1$s

for example to make it swith the lat/lon order from what it expects.

@rnorris
Copy link
Collaborator

rnorris commented Jan 29, 2019

Addressed with #39

Add since you can also change the default ordering via the "printf positional arguments" technique '%n$' for the Nth argument - there is no need for an additional parameter reordering methods.

@rnorris rnorris closed this as completed Jan 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants