I was wondering if there are any alternatives to pgRouting tools.

Thinking about it for a bit, I think the only alternative is to use R or RPY to do the analysis.

Basically I'm trying to solve routing problems based on nonPostGIS databases. As most of my data is actually stored in a different format; however, it's not to hard to convert. I'm finding that pgRouting to my dumb silly brain is difficult to implement. So perhaps a non-database solution that I can easily tweak would be ideal for me

11 Answers 11


[Edit: this has been superseded by nx_spatial which is available from pypi (easy_install nx_spatial). Importing shapefiles is now standard in networkx 1.4]

I've been kind of disappointed by the lack of geometric network tools in ESRI's Python GP API, so I wrote up something that loads Shapefiles and Feature Classes into networkx directional graphs (DiGraphs).

It is still a work in progress, but it might be an okay starting off point for something that can help with your problem.



from utilitynetwork import Network

net = Network()

#load single file, method reqs OGR

#load directory full of shapefiles

#load a feature class, req ESRI gp object, should work with shps as well
import arcgisscripting
gp = arcgisscripting.create(9.3)
net.loadfc("C:\somedb.gdb\featureclass", gp)

#Accessing node/edge data is done by the key value (the geometry as a tuple).
#access node data at x=4, y=2
nodekey = (4, 2)

Network is inherits from networkx.DiGraph, so all of that functionality is available.


Although the thread is a bit old, I wanted to add a few links about routing in case someone ends here like I did:


There's Flowmap, a niche GIS package designed for dealing with network analysis issues.

If you have a fairly simple use-case, the QGIS-based Quantum Navigator might do the trick.

GRASS also supports network analysis, though it may not be worth the friction of getting things set up inside of the environment.


You can have a look into the open source GraphHopper project - a fast and flexible route planner. Try it out here. Note: I'm the author


We also did some research the last years but we are still happy with pgRouting and think it is the best solution for our GIS-Routing-needs. Unfortunately there is not much around that I know of (without having to pay thousands of Euros/Dollars). We work with Navtech-Data, that has a perfect network to work with but is not cheap. We also tried from time to time with OSM which worked OK ... but always made some problems and therefore never made it into production.

We also just came across the above mentioned open source GraphHopper project (some weeks ago) and think, that it has very good performance und possibilities. As far as I know - they also have OSM Data running within their project.


Many routing problem use Dijkstra's algorithm to determine shortest path. It's relatively straightforward to code: http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm

Also, Guido van Rossum wrote an early essay about graphs in Python. His short piece includes an approach for primitive route data structures and coding: http://www.python.org/doc/essays/graphs.html

There are a lot of routing packages out there. For specifically geographic purposes, besides pgRouting, graphserver (http://bmander.github.com/graphserver/) and ESRI ArcGIS Network Analyst come to mind. The social network analysis community has a list of graph analysis software at: http://www.insna.org/software/index.html and http://www.insna.org/software/software_old.html. Many of those packages are open source and relevant in a geographic context. For highly-sophisticated, robust or complex calculations, linear programming packages like CPLEX and Lindo Lingo might be worth investigating.


You could use GeoTools' graph package to do the routing too.


You can also have a look at the tools from RouteWare. Long track record and not database bound


You can use GraphHopper API - They have a matrices component that you can work within called the Matrix API

There is also Mapzen Leaflet Routing Plugin or the Mapzen Valhalla engine

as well as Mapbox Distance API which you can tap into the


In Alpha release but looks promising:

GeoDaNet (Alpha) - Spatial point pattern analysis on networks (based on PySAL Ptyhon library, concieved in GeoDa centre).

(Slides, manual, download.)


There are two new players in R software environment (personally untested):

Looking at the docs and examples they offer solid functionality and interesting features, but I haven't had a chance to test them myself and don't know how they stack against real life applications, and particularly - against more wicked problems like very large data or multimodal networks, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.