A Routing Engine Of One’s Own: DIY Valhalla

Mapzen’s software has always been open source, including Valhalla, our powerful routing and navigation engine that powers our Turn-by-Turn service. Anyone can download the code and run it for themselves, but the compilation step can be a barrier to many.

Starting with Valhalla, we are making parts of our server-side code available via Ubuntu Personal Package Archives or PPAs. This makes it possible to install with a simple apt-get command, which in turn makes it easy to include Valhalla on a fresh Ubuntu server or as part of a container recipe for Docker or Vagrant. We’ve published Valhalla to ppa:mapzen/routing.

Whether you want to experiment or need a very large number of routing requests for analysis, now you can get Valhalla routing working on your own server in just a few minutes!

# Add Mapzen routing PPA
add-apt-repository -y ppa:mapzen/routing
apt-get update -y

# Install Valhalla code
apt-get install -y valhalla-server

# Try a multimodal route in San Francisco
curl -g 'localhost:8002/route?json={"locations":[{"lat":37.764472,"lon":-122.422027},{"lat":37.817242,"lon":-122.372417}],"costing":"multimodal"}'

That’s it. Valhalla comes with data for San Francisco, and a simple interactive demo available at your http://localhost/demo.html:

Biking in SF screenshot

We’ve also made data available for all of the SF Bay Area, Rome and New York City in one-time sample files:

You can install the above data packages just by unpacking them into the directory /var/valhalla-server:

# Unpack new tiles into /var/valhalla-server
tar -C /var/valhalla-server -xzvf rome-2016-09-07.tgz

# Restart Valhalla to use the new tile data
/etc/init.d/valhalla-server restart


  • We’re working on how to best deliver data for other cities, stay tuned for more.
  • If you are testing multimodal routing, note that these data packages include transit data for SF, NYC and Rome for September 2016, so be sure to include relevant data ranges in your URL if you aren’t running this in September 2016. Details on use_ and date options are discussed in the transit routing blog post.
  • For reference, here is a sample multimodal route that specifies dates and transit weights:

  • See Mapzen documentation for more useful information on Valhalla.

  • Limit for the number of stops and distance for can be changed in /etc/valhalla-server.json (note that longer requests with more stops will use more memory!)

  • Time-Distance Matrix and Optimized route requests are not yet supported in this package.

Whether you route by car, foot, bike or transit, let us know what you think – suggestions are welcome!