Fork me on GitHub

Leaflet Routing Machine

Easy, flexible routing for Leaflet

About Getting Started Tutorials API Download

Tutorials

Leaflet Routing Machine tries to give a simple solution to a complex problem: routing can be many things, and the user interface for various scenarios differs wildely; in the same way, most sites want to apply their own styling to the user interface. Leaflet Routing Machine solves this by comming with sane defaults: adding basic routing capabilities is just a few lines of code. At the same time, Leaflet Routing Machine is very extensible and customizable both in terms of functionality as well as styling.

Below is a list of short tutorials that show how some common use cases can be solved with Leaflet Routing Machine. If you can't find what you're looking for here, the API docs contains the full, technical details for how to work with Leaflet Routing Machine.


Basics

This tutorial focuses on downloading the plugin the first time and taking it for a test drive. It also gives some pointers on where to go from here.

Addresses and geocoding

Explains everything about adding address lookups to Leaflet Routing Machine.

Interaction

How to interface between your app and the plugin. Add and remove waypoints, reversing the route, and similar use cases.

Integration

More advanced interaction between your application and Leaflet Routing Machine, such using events and storing found routes and expanding the user interface.

GraphHopper, Mapbox, Valhalla and other routing software

OSRM is a great router, and used by default in Leaflet Routing Machine, but there are several alternatives that are on par. This tutorial explains how to use other routing backends, even writing support for new ones.


Copyright © 2015 Per Liedman, released under ISC License. Logo by Alexey Ivanov, released under Creative Commons CC-BY 3.0.
×

Sorry! The OSRM demo server appears down, or a network error occured.

This prevents Leaflet Routing Machine from displaying a route. The demo server will hopefully be back up soon. Please do not report this as an issue, Leaflet Routing Machine has no control over the demo server.

In production, set up your own OSRM instance, or pay a service provider.