leaflet-routing-machine icon indicating copy to clipboard operation
leaflet-routing-machine copied to clipboard

Support for non-Leaflet map canvases

Open danpat opened this issue 8 years ago • 1 comments

Over here at the OSRM project, we're using the LRM plugin for http://map.project-osrm.org/ (https://github.com/Project-OSRM/osrm-frontend).

We'd like to port the map to be vector-based, using Mapbox GL JS. The primary motivation is to enable a much better debugging interface to OSRM, integrating the built-in tile generator with the main map, making it easy to toggle various layers when trying to figure out why we're getting weird routes.

@perliedman have you ever considered supporting map canvases other than Leaflet? I took a poke around to see what would need to be modified and it looks doable, but I'm not sure what abstraction would work best.

danpat avatar Jun 15 '17 10:06 danpat

I did consider this at some point (in that case making it compatible with OpenLayers), but since I did not really have a use case, and there seemed to be more pressing issues to address, I never did anything about it.

As for the map interaction part, I think this could be pretty straight forward: we need some kind of abstraction to draw lines and markers on a map, and also for controlling the map's view etc. I imagine that would be the easy part.

What I think would be the problem is that LRM today is tightly couple to Leaflet's class system (L.Class) as well as its event system (L.Evented). I'm not entirely sure what the best approach would be here. Theoretically we could just let this be as it is, but that would mean LRM would still depend on Leaflet even when used with another map library. To me, that doesn't feel right. On the other hand, LRM needs some sort of class system to rely on (could be ES6 classes, maybe), and some event system (a lot of options out there).

So, this would require some thinking. I'm posting this here as some kind of brain dump of what I think needs to be addressed to move forward.

perliedman avatar Jun 19 '17 08:06 perliedman