using Python to access brouter algorithm

128 views
Skip to first unread message

Bryan Keith

unread,
May 8, 2021, 6:01:25 AM5/8/21
to OSM Android bikerouting

Hello,

I've read through this forum and done some web searches with no luck.

I'd like to get results from the brouter algorithm via Python -- for example, send a couple lat-lon pairs and return a route with distance, elevation, and bicycle travel time estimate.  Is this possible?  What's the best way to accomplish this?

Do I need to install brouter web app on localhost?  Is an API available for the live servers?  Are there Python packages?  I feel like a web installation shouldn't be necessary at all, yet it seems like maybe it is (but it's not 'cause I have brouter working offline with osmand on android).

Thank you for your help,

Bryan

Norbert Renner

unread,
May 10, 2021, 4:46:46 PM5/10/21
to OSM Android bikerouting
The simplest option is probably to start BRouter as a HTTP server on localhost and send requests to that from Python, either by using the server part of the BRouter-Web standalone zip or building and starting from source:

See URL documentation here:

There is no public API service. Android apps call the Android Intent service interface:

We don't provide any packages or bindings for Python. In theory, there might be some general options to call Java from Python or to run Python scripts in a compatible Java runtime, but I personally have no experience using those with BRouter and there is also no documentation for embedding BRouter:

Norbert Renner

unread,
May 10, 2021, 4:59:01 PM5/10/21
to OSM Android bikerouting
There also is/was a command line call that writes the result to a file, but I don't know if that's actually still working:

Bryan Keith

unread,
May 13, 2021, 11:36:56 PM5/13/21
to osm-android...@googlegroups.com
Ok, Norbert,

Thank you for the response.  I'll look into those options.

Bryan
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "OSM Android bikerouting" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/osm-android-bikerouting/Ewj9X4-Ldq8/unsubscribe
> <https://groups.google.com/d/topic/osm-android-bikerouting/Ewj9X4-Ldq8/unsubscribe>.
> To unsubscribe from this group and all its topics, send an email to
> osm-android-biker...@googlegroups.com
> <mailto:osm-android-biker...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/osm-android-bikerouting/945808bc-941d-428b-a117-652a302921a2n%40googlegroups.com
> <https://groups.google.com/d/msgid/osm-android-bikerouting/945808bc-941d-428b-a117-652a302921a2n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Reply all
Reply to author
Forward
0 new messages