Need advice about which tool to choose?Ask the StackShare community!
Valhalla vs pgRouting: What are the differences?
Introduction: Valhalla and pgRouting are two popular routing engines used in geographical information systems (GIS). While both are powerful tools for calculating routes, there are several key differences between them that make them suitable for different use cases.
Data Sources: The first significant difference between Valhalla and pgRouting lies in their data sources. Valhalla utilizes OpenStreetMap (OSM) data to compute routes, enabling it to take advantage of the rich and constantly updated information available in OSM. On the other hand, pgRouting can work with various data sources, including OSM, databases like PostgreSQL, or even Shapefiles, providing more flexibility in choosing the underlying data.
Network Model: Valhalla and pgRouting employ different network models for routing calculations. Valhalla uses a multi-modal graph model, which means it can handle not only road networks but also other travel modes like public transit, biking, or walking. This flexibility makes Valhalla suitable for diverse routing scenarios. In contrast, pgRouting utilizes a more traditional network model specifically designed for road networks, making it a preferred option when focusing solely on road-based routing.
Algorithmic Approach: Another key difference lies in the algorithms employed by Valhalla and pgRouting. Valhalla relies on a custom algorithm called "Dijkstrance" that combines A* search and Dijkstra's algorithm, allowing it to compute routes efficiently with options like time-aware or distance-optimized routing. In contrast, pgRouting offers a range of routing algorithms, including Dijkstra's, A*, or even bidirectional algorithms, giving users more flexibility when choosing the algorithm best suited for their specific use case.
Extended Features: Valhalla and pgRouting also differ in terms of the additional features they offer. Valhalla, for instance, provides advanced features like turn-by-turn directions, isochrones (areas reachable within a specific time or distance), and matrix calculations (computing travel times or distances between multiple points). On the other hand, pgRouting comes with a set of useful functions to work with road networks, including functions for calculating closest points, calculating shortest paths across multiple layers, or even performing network analysis operations.
Integration and APIs: Valhalla and pgRouting also offer different integration options and APIs. Valhalla provides a complete routing solution with customizable server-side APIs and SDKs for different programming languages, facilitating its integration into various systems. Conversely, pgRouting integrates directly into the PostgreSQL database, providing seamless integration with spatial databases and enabling SQL-based queries for routing calculations.
Community and Support: Lastly, Valhalla and pgRouting differ in terms of their communities and support. Valhalla has gained popularity within the open-source mapping community and benefits from active developer support. It also has an extensive documentation repository and a dedicated issue tracker for bug reporting. On the other hand, pgRouting has a well-established community built around the PostgreSQL ecosystem, providing forums, mailing lists, and official documentation specific to pgRouting.
In summary, Valhalla and pgRouting differ in their data sources, network models, algorithmic approaches, extended features, integration options, and community support. Understanding these differences is crucial in selecting the appropriate routing engine based on the specific requirements of a GIS project.
Pros of pgRouting
- Dynamic routing3
- Routing in the database1
- Open Source1
- Data changes are reflected instantaneously1
- Geospatial network analysis1
- QGIS plugin1
Pros of Valhalla
- Open source2