I'm a real javascript and leaflet novice, but I have started trying to
do a routing + D3 + leaflet type project here, so have read this
conversation with interest!
https://github.com/JimShady/Stoller-Routing
Index:
http://htmlpreview.github.com/?https://github.com/JimShady/Stoller-Routing/blob/master/index.html
Note that if you left click a few times on the map and then right
click it should show you your array of points.
My workflow is planned to be:
1) Use leaflet for the map and to collect an array of lat longs from
the user clicking on the map
2) From this construct a URL to send to the API here:
https://github.com/DennisOSRM/Project-OSRM/wiki
3) Get the route back as a JSON, parse it using jQuery, and extract
the overview polyline field
4) Use this package to decode the polyline and display it on a map:
https://github.com/jieter/Leaflet.encoded
I'm doing this as a learning project really. At the moment I'm stuck
as I haven't figured out the cross-domain JSON thing... but doing so
is part of the learning process.
Anyway, I realise this doesn't really solve any of the issues in this
conversation, I just thought that people might be interested!
Jim