Seeking alternatives to pgRouting for open source routing / network analysis?

[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.

http://bitbucket.org/gallipoli/utilitynetwork/

Samples:

from utilitynetwork import Network

net = Network()

#load single file, method reqs OGR
net.loadshp("/shapefiles/test.shp")

#load directory full of shapefiles
net.loadshp("/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)
net.node[nodekey]

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:

  • OSRM <- Recommended
  • Routino

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.