Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

share|improve this question

10 Answers 10

up vote 13 down vote accepted

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

share|improve this answer

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

share|improve this answer
OSRM made my day... :) thank you... :) –  Ade'l Mar 5 '13 at 12:29

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.

share|improve this answer

If you're looking for a programatic pythonic solution, take a look at networkx

share|improve this answer
Any libraries for going from .shp to networkx? I could build one myself in Python, but I'd rathe rnot reinvent the wheel... –  fmark Jul 30 '10 at 3:16
Its not exactly a 1:1 match since shapefiles store data as simple features, not topological networks. So you need to know/assume some things about your source dataset first - primarily that all intersections are terminal nodes for a linestring. Here is an example of using geodjango to convert simple features into a networkx graph: code.google.com/p/marinemap/source/browse/lingcod/spacing/… –  perrygeo Aug 2 '10 at 16:17

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

share|improve this answer
I think this sample is related to GeoTools graph usefulpracticalgeoblog.blogspot.com/2011/03/… –  ThomasG77 Mar 8 '11 at 9:08

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

share|improve this answer

Not sure if that fits your particular requirements bu it might be worth looking at network extension of gvSIG.

share|improve this answer

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.

share|improve this answer
the problem is that most of these solutions need a system of nodes and links, and GIS data is usually not stored that way –  dassouki Aug 5 '10 at 11:06
Network analyst is about $2,500 and not really interested in making such a purchase now. I'd rather have a pythonic solution –  dassouki Aug 5 '10 at 11:07
Dijjkstra is for very basic graphics. For real life problems, usually it is a very heavy and slow algorithm. Also, ESRI software, as it is not open sourced, is difficult to improve and is slowly being left behind in favor of other tools. –  Délawen Dec 11 '13 at 11:43

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

share|improve this answer

You can have a look into the open source GraphHopper project - a fast and flexible route planner. Try it out here.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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