perliedman / leaflet-routing-machine

Control for routing in Leaflet
https://www.liedman.net/leaflet-routing-machine/
Other
1.06k stars 347 forks source link

[suggestion] [plugin] Caching routes #650

Open nicolaschaufette opened 2 years ago

nicolaschaufette commented 2 years ago

Hello,

This is a re-open to suggestion "Caching routes #471". I had this need for my project so I implemented it. It's probably not perfect (it may break the "requires more detail" on zoom feature) but fits my needs so far. Let me know if you have comments or request for improvements.

https://github.com/nicolaschaufette/leaflet-routing-machine-cached-router https://codepen.io/nicolaschaufette/pen/BamrRMX

curtisy1 commented 2 years ago

Thanks for the suggestion!

This seems like a reasonable idea. I agree it would probably break some other functionality but that's easily mitigated by giving the user an option of whether caching or "live updating" routes fits their needs best.

Unfortunately, I don't have plans to implement this myself for the upcoming v4 which is mostly focused on modernizing the existing codebase and introducing typescript. It would be a great middleware-like addition to any future v5 which I plan to fully modularize.

That being said, if you want to try bringing this into the next release, please submit a pull request to the typescript branch as it has the most ongoing changes for the upcoming v4