Modify

Opened 3 months ago

Last modified 4 days ago

#23904 assigned task

Write new routing plugin

Reported by: taylor.smock Owned by: taylor.smock
Priority: normal Milestone:
Component: Plugin Version:
Keywords: routing Cc: gaben

Description (last modified by taylor.smock)

Problem:
Mappers attempting to debug why a routing engine does stupid things or takes poor routes.

Solution:
Show mappers a route with route instructions as they edit live.

Goals:

  1. Use production routing engines
  2. Show routing instructions in JOSM for given modes (pedestrian, biking, vehicle, and possibly public transport)
  3. [Stretch goal] If routing engine supports it, show weights for ways in given mode; this should allow debugging why a different route was not chosen.

MVP will use one of the specified routing engines and show routing instructions in JOSM.
I am currently investigating using valhalla for the initial routing engine. This will most likely require Java 22 for FFI support without JVM flags. Alternatively, I can use JNI or a derivative thereof. As an additional alternative, if the routing engine exposes a web interface or a command line interface, we can use those for routing support.

Possible implementation details:
Valhalla (MIT):

  • Provides a C++ library (libvalhalla)
  • Provides a web interface
  • Provides a CLI

OSRM (BSD 2-clause):

  • Provides a C++ library
  • Provides a web interface

OSMAnd (GPLv3):

  • Java library and bindings already written (thanks to Android)
  • Has some kind of web interface (see comment:2)

Organic Maps (Apache 2):

  • Java library and bindings already written (thanks to Android)

Most likely, I will have to write the current edit layer to pbf in order to load it into a routing engine. There may be additional steps, such as converting the pbf to the engine specific format.


This plugin should completely replace the routing plugin which uses custom Java code for routing.

Attachments (0)

Change History (6)

comment:1 by taylor.smock, 3 months ago

Description: modified (diff)

comment:3 by taylor.smock, 7 weeks ago

Description: modified (diff)

I probably can't send the website arbitrary OSM data (AKA whatever the editor has changed); at a minimum, I'd have to spin up an instance on-device.

I could use it as a "status as of whenever OsmAnd updated their backend routing db".

Thanks for the information.

in reply to:  description comment:4 by eneerhut, 9 days ago

Is there anything I can do to help with the plugin Taylor? Let me know if mini-PRD defining the features of the routing plugin would be helpful.

Replying to taylor.smock:

Problem:
Mappers attempting to debug why a routing engine does stupid things or takes poor routes.

Solution:
Show mappers a route with route instructions as they edit live.

Goals:

  1. Use production routing engines
  2. Show routing instructions in JOSM for given modes (pedestrian, biking, vehicle, and possibly public transport)
  3. [Stretch goal] If routing engine supports it, show weights for ways in given mode; this should allow debugging why a different route was not chosen.

comment:5 by taylor.smock, 8 days ago

I don't think so; I've got the UI up and running, and I'm now working on building valhalla for different platforms.

See https://github.com/tsmock/routing2 for the test repo. It will be deleted and cleaned up prior to when I notify some community channels about its availability. There are way too many commits to 'change foo to see if that works in GH actions'.

Right now, the plugin is doing the following:

  • Calling the valhalla CLI with a hard-coded set of parameters (example, uses car instead of pedestrian)
  • The start/end location can be specified in UI (as lat/lon)
  • The route instructions are shown with additional information
  • The selected instruction will also be highlighted in the map
  • Uses the current data layer for routing (so users can see livish what happens when they change a maxspeed, for example -- livish since it takes 10-30s to rebuild the routing graph and generate the route)

What needs to happen prior to making the plugin available for public testing:

  • Compile valhalla for:
    • mac
      • x86
      • arm64
    • Windows
      • x86
    • Linux
      • x86

Right now, I don't think Windows and Linux have significant numbers of arm users. For linux, I will (probably) eventually look into something like https://icculus.org/fatelf/ , but x86 support should be "ok" for now.

I do think I'm almost done getting the compilation steps done for mac -- I've got the x86 and arm64 versions built, and am currently working on merging them into a universal "fat" binary.

Once I get those built, I'll then have to decide whether or not to make separate plugins for each platform. Example:

  • routing2: Common java files, depends upon virtual dependency routing2-valhalla. Hard dependency may be removed in the future, if other routing engines are supported.
  • routing2-valhalla: Virtual dependency fulfilled by platform-specific jar files with the requisite version of valhalla.

For community members reading along, the plugin is not ready yet. Specific problems I'm currently working on:

  • You need to have built valhalla and installed it yourself
  • Really poor route rendering -- it is "just" a green line with red start/stop points right now

comment:6 by gaben, 4 days ago

Cc: gaben added

Modify Ticket

Change Properties
Set your email in Preferences
Action
as assigned The owner will remain taylor.smock.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from taylor.smock to the specified user. Next status will be 'new'.
Next status will be 'needinfo'. The owner will be changed from taylor.smock to taylor.smock.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.