Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

11 Answers 11

up vote 15 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:… – 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… – 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:

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:

There are a lot of routing packages out there. For specifically geographic purposes, besides pgRouting, graphserver ( and ESRI ArcGIS Network Analyst come to mind. The social network analysis community has a list of graph analysis software at: and 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
@dassouki all GIS data is essentially nodes and links, and tools like osm2pgrouting, and other pgRouting scripts in general, convert existing GIS / spatial data into the necessary nodes and links and edges that are used in pgRouting... – DPSSpatial Jan 27 at 21:53

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. Note: I'm the author

share|improve this answer

I am a bit late to the party here. But you can use Grasshopper 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

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.