-
Notifications
You must be signed in to change notification settings - Fork 350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save route information #17
Comments
Sorry for a very late reply, but this can be accomplished by storing the waypoints from Please refer to the recently published API docs for details: http://www.liedman.net/leaflet-routing-machine/api/#l-routing-control |
Sorry for my delayed anwer too, but it was related to the OSRM data (sorry for not ask properly) In my case, I'm interested in store _routes["number_of_route"].coordinates I don't know if is a easy access for that part, but It would be helpfull to get OSRM information available with a function too Greetings |
When a route is found, the control fires the event |
@cristomc Hi! Did you find a way to store the route info? My use case is that I want to store a specific route (might be an alternative route) in a database for later use. Trip planning for instance. |
You might want to save the itinerary and the summary as well, since it's not trivial to get those back later. |
hm, yes, good point. |
hi @eigan , I just saved the waypoints and the routepoints when you are "creating" a route: _routes.coordinates gives you the whole coordinates(I needed in my case) of the route. But, if you want to save the waypoints of each route, you can save it with getWaypoints(). When you need recover it (to show them) you only need restore the waypoints and create a new instace of route with them I hope you can use this info ;) |
Thanks for inputs @cristomc :-) The problem with only storing waypoints is that the route might be different later (new roads, new algorithm for calculating routes, etc). So I figured storing the entire line/geometry would be a better approach in the long run. |
If you want to reduce the size of the coordinates, you might want to look at this: https://github.com/jieter/Leaflet.encoded OSRM already uses this encoding when sending the coordinates over the wire, and |
Will do, thanks :-) |
Hi eigan, I would like to know have you solved this . because I too have same requirement. I want to store route related line and points , even after years I need to draw same route as wat it is giving now ... For that I need to store the line related data. |
@tvjmohan it's pretty straight forward to store a route as GeoJSON, and you can store that in a database, file or whatever. Displaying GeoJSON on a map later is also very easy. There's no builtin function for turning a route into GeoJSON in LRM, but I've written several versions of it before. You can for example use this code, which hasn't been included in the stable version of LRM: https://github.com/perliedman/leaflet-routing-machine/blob/344ff09c8bb94d4e42fa583286d95396d8227c65/src/L.Routing.js |
Hi, I have seen the code. I just want to know how can i get it into javascript variable. i am not sure which method to cal and what code i have to write (or use from ) in my program. Please help me. |
Depends a bit on your environment, but you could probably get it to work by copying the two functions in that file into your code. |
Hmmm. I am using Windows... And simple HTML CSS JavaScript project. I will try it ... If I get it OK else ... I need ur help. Thank you ..
|
Hi , |
@gfoxx29 it's not clear to me what you're asking. You say you need the coordinates and time, but also that you "only" have the coordinates and the time. You can always look at how the itinerary is built ( |
@perliedman time | coordinates time = the time to get location |
@gfoxx29 ok, alright! Look at the |
hi,man ! My project now is about an indoor map route. I have to make a custom route by myself from one room to another room ,but I don't know how to begin making it .please give me some advice.thanks! |
Bonsoir tout le monde, j'ai besoin de votre aide s'il vous plait, |
Hi, I'm trying to save the data in a database of the routes that i create.
I'm using at the moment getPlan() to pick all the data of the route, but i have some doubts.
Maybe there should be a google group forum where to ask this kind of questions, instead using this place.
Thank you in advance! :)
The text was updated successfully, but these errors were encountered: