Bug 374446

Summary: Improvements to CycleStreets API calls
Product: [Applications] marble Reporter: CycleStreets <kdebugs>
Component: dataAssignee: marble-bugs
Status: CONFIRMED ---    
Severity: wishlist CC: nienhueser, simonandric5
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: All   
Latest Commit: Version Fixed In:

Description CycleStreets 2017-01-02 02:12:32 UTC
Hi,

I'm writing from CycleStreets, whose API you have kindly integrated for bicycle routing:
http://commits.kde.org/marble/af22018eb38e7ff48b10ab0a131809a342db8a1c

We get plenty of requests from Marble users, which is great. Here are a few enhancements you could make:

Currently Marble makes requests like this:
/api/journey.xml?itinerarypoints=11.431882,44.465502%7C11.437141,44.519076&key=cdccf13997d59e70&plan=balanced&speed=20&useDom=1
(prefixed with http://www.cyclestreets.net )

1) The site is now available as HTTPS. For user privacy, please do change http://www.cyclestreets.net to https://www.cyclestreets.net . This is naturally a simple change.

2) plan=shortest is an option currently, but in future we are likely to deprecate this, as in practice it does not give useful routes. For instance, it will take someone directly over the top of a very steep hill if that is the shortest route when a more sensible alternative exists.

3) If you wish, you can send waypoints, i.e. A-B-C-... routing, rather than just be limited to A-B.

4) JSON output is available, which means simpler parsing and the ability to obtain an error status. XML will continue to be available, but JSON presumably would enable the code to be simplified. Just change .xml to .json and remove &useDom=1.

5) To enable error status (when using JSON), add &reporterrors=1 to the URL.

Overall, therefore, the request would now be:

/api/journey.json?itinerarypoints=11.431882,44.465502%7C11.437141,44.519076&key=cdccf13997d59e70&plan=balanced&speed=20&reporterrors=1
(prefixed with https://www.cyclestreets.net )

If an error occurs, the output would be in this format:

{"error":"The plan parameter must be specified in the v1 API"}

where the value on the right side is a human-readable error.
Comment 1 Dennis Nienhüser 2017-01-02 18:08:56 UTC
Thanks for reporting, appreciated!
Comment 2 Dennis Nienhüser 2017-01-02 18:38:12 UTC
Git commit 1fa82b8452de4a9de5966c573e032e83c5e6dfb5 by Dennis Nienhüser.
Committed on 02/01/2017 at 18:15.
Pushed by nienhueser into branch 'master'.

Remove the shortest option.

It makes little sense and will be deprecated/removed in the future.

M  +0    -1    src/plugins/runner/cyclestreets/CycleStreetsPlugin.cpp

https://commits.kde.org/marble/1fa82b8452de4a9de5966c573e032e83c5e6dfb5
Comment 3 Dennis Nienhüser 2017-01-02 18:38:12 UTC
Git commit 13b2773ca9f217d7e96f8b45adc915fccd26b477 by Dennis Nienhüser.
Committed on 02/01/2017 at 18:13.
Pushed by nienhueser into branch 'master'.

Use https for cyclestreets calls

M  +1    -1    src/plugins/runner/cyclestreets/CycleStreetsRunner.cpp

https://commits.kde.org/marble/13b2773ca9f217d7e96f8b45adc915fccd26b477
Comment 4 Dennis Nienhüser 2017-01-02 18:41:20 UTC
1) Done
2) Done
3) From what I can tell we already support that. Just verified it still works in git master.
4) 5) Added GCI task https://codein.withgoogle.com/tasks/5552084436910080/