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
Answer
[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.
No comments:
Post a Comment