
Show HN: Valhalla, an open source routing engine - sevko
https://mapzen.com/projects/valhalla
======
jakobdabo
How does this compare to Project OSRM [1]?

[1] [https://github.com/Project-OSRM/osrm-backend](https://github.com/Project-
OSRM/osrm-backend)

~~~
alpensiedler
this blog post explains some of the major differences in the two
architectures: [https://mapzen.com/blog/valhalla-
why_tiles](https://mapzen.com/blog/valhalla-why_tiles)

~~~
glennon
The OSRM routing engine appears to focus on contraction hierarchies; is that
also the case for Valhalla?
[http://en.wikipedia.org/wiki/Contraction_hierarchies](http://en.wikipedia.org/wiki/Contraction_hierarchies)

------
sevko
Also, source code is here:
[https://github.com/valhalla](https://github.com/valhalla)

~~~
davexunit
Since most routing software is proprietary, I think it would be good to combat
it by using a strong copyleft on the Valhalla components. GPLv3+ for client
software and AGPLv3+ for server software would be awesome.

~~~
glennon
Glancing at the Valhalla repos, it looks like the MIT license across the
board: [https://github.com/valhalla](https://github.com/valhalla) ;
[https://github.com/valhalla/thor/blob/master/COPYING](https://github.com/valhalla/thor/blob/master/COPYING)
; [https://github.com/valhalla/chef-
valhalla/blob/master/LICENS...](https://github.com/valhalla/chef-
valhalla/blob/master/LICENSE.md) ; etc...

Also, it's not so much that the routing engines are proprietary -- the best
ones are not. The underlying databases are the secret sauce.

~~~
ma2rten
what are the best ones?

~~~
glennon
For speedy street routing, the Open Source Routing Machine: [http://project-
osrm.org/](http://project-osrm.org/) Like Google's proprietary routing engine,
it leverages the scale of local and regional travel (via contraction
hierarchies, arterial travel is suited for precomputed cacheing); result: the
system can be tuned to give near instantaneous results. OSRM had been led by
Dennis Luxen of Mapbox, though he just moved to Apple. The OP (Mapzen's
Valhalla) appears to have a similar approach as OSRM. Good libraries for other
scenarios exist; e.g., cycling and multimodal planning -- see:
[http://wiki.openstreetmap.org/wiki/Routing](http://wiki.openstreetmap.org/wiki/Routing)
and OpenTripPlanner
[https://github.com/opentripplanner/OpenTripPlanner](https://github.com/opentripplanner/OpenTripPlanner)

There's an academic Thesis on the principles of contraction hierarchies that
is worth a look if you're in this space.
[http://algo2.iti.kit.edu/documents/routeplanning/geisberger_...](http://algo2.iti.kit.edu/documents/routeplanning/geisberger_dipl.pdf)
My favorite is actually a Master's thesis that steps through the process of
using contraction hierarchies to build a routing engine (MoNav) on
OpenStreetMap data.
[https://code.google.com/p/monav/downloads/detail?name=thesis...](https://code.google.com/p/monav/downloads/detail?name=thesis.pdf&can=2&q=)

For nuanced or complex problems, set up your objectives and constraints
against a good solver:
[http://en.wikipedia.org/wiki/List_of_optimization_software](http://en.wikipedia.org/wiki/List_of_optimization_software)
I'm partial to Google's OR Tools [https://github.com/google/or-
tools](https://github.com/google/or-tools) (Apache License).

~~~
karussell
Just curious: Where did you heard about that Dennis moved to Apple :) ?

Some clarification:

* the process of the route finding is done by Dijkstra or A* or with a preprocessing (CH)

* valhalla does not use CH to my knowledge

* route optimization requires a completely different technique and valhalla does not do this

> "The OP (Mapzen's Valhalla) appears to have a similar approach as OSRM"

no :) ! OSRM is limited to CH (really fast) and valhalla is limited to
Dijkstra/A* (really flexible).

~~~
glennon
@karussell,

For a public source, Dennis Luxen updated his Linkedin profile.

Thanks for adding your knowledge about the internals of Valhalla code.

~~~
karussell
ah, easy, thanks :) !

------
davexunit
I'm a bit confused. This doesn't seem like free software after reading the web
page. It seems that the client is free, but the server component is
proprietary SaaS and you have to get an API key through MapZen? I see several
repositories on their GitHub account, but it's not apparent if this is all
that is needed to self-host.

~~~
randyme
There is no proprietary component, if you want to self-host it's all here:
[https://github.com/valhalla](https://github.com/valhalla)

But there is a free hosted service (with API signup) for convenience.

~~~
davexunit
Awesome. Thanks for clarifying.

------
jastoltz24
Looks great! I really like the norse themed repository names ... though I'm
not familiar with "demos" and "conf", are they some sort of mythical norse
figures as well?

~~~
hnyc
Demos, the great God of demonstrations and examples. He preferred to teach
other Gods, as opposed to humans. Usually he could be found skulking nearby or
with API, the God of documentation.

Conf, the lesser known God of configurations and setups. He made sure that
everything was well defined in a single place in a concise format, such as
acceleration due to gravity, etc.

~~~
pki
How do you pronounce API?

------
TheSwordsman
I think I may have found an issue with this. I tried to get directions, and it
fell off a random road and then proceeded to have me swim across the San
Francisco Bay:

\- [http://i.imgur.com/wWilOoC.png](http://i.imgur.com/wWilOoC.png)

~~~
winddog001
Having worked in the routing space (not on this project) and reviewing the
code, the implementation is professional-grade. Where as OSM data is rich and
challenging to work with for routing purposes.

Your feature/bug: the router told you to take a ferry. You'll see the ferry
route represented here:
[http://www.openstreetmap.org/search?query=SF%2C%20CA#map=13/...](http://www.openstreetmap.org/search?query=SF%2C%20CA#map=13/37.7862/-122.3625)

------
andrewguenther
There doesn't seem to be any priority on freeways. I could route across the
entire U.S. and never get on a freeway....

------
zzleeper
A quick question: I have a list of 100+ million points with their geographical
distance, but I want to improve it and calculate the "driving distance". How
expensive in terms of time/ops would that be?

I'm scanning the different subprojects on Github and I think Tyr is the one I
need, but I'm not entirely sure..

~~~
magila
Are you a salesman by any chance?

~~~
Dewie3
Nah. Ebay already solved that problem.

~~~
hnyc
Obligatory: [https://xkcd.com/399/](https://xkcd.com/399/)

~~~
Dewie3
Heh, I liked it better when it was implied.

------
bebop
Neat project.

There is also a Postgres/Postgis extension pgRouting
([http://pgrouting.org/](http://pgrouting.org/)) that will do routing in the
database.

------
dmitrykoval
Any plans to add public transport support?

~~~
randyme
Yes -- if you're at State of the Map US in NYC this weekend, we'll be demoing
it live. Stay tuned.

~~~
dmitrykoval
Looking forward!

------
juliangoldsmith
Does anyone know how good the OpenStreetMap data is? I thought I'd heard that
it was pretty incomplete.

~~~
maxerickson
Try it for some routes you are familiar with:

[http://www.openstreetmap.org/directions?engine=osrm_car&rout...](http://www.openstreetmap.org/directions?engine=osrm_car&route=25.774%2C-80.194%3B42.440%2C-76.497#map=5/34.615/-79.080)

It varies around the world, for the US (which I'm more familiar with)
intercity is pretty solid, last mile stuff you might be missing a street.

Searching for a specific address can be an issue, but road data is pretty
good.

------
coolandsmartrr
Excuse me if this sounds irrelevant, but why name it after Nordic mythology?

------
synaesthesisx
WE SHALL RIDE THROUGH THE GATES OF VALHALLA, SHINY AND CHROME!

~~~
mozumder
Oh what a website.. WHAT A LOVELY WEBSITE!

