I am trying to use the graph-tool to perform a huge automated series of
path analyses as part of a commute-justice project I am working on. I am
very new to graph-tool and somewhat new to Python.
I have converted an ESRI shapefile of street centerlines in Los Angeles
County into a GT file using this short script:
GitHub - CordThomas/shp2gt: Shapefile to graph-tool gt file format converter - i think it creates a valid
graph-tool network. Prior to that conversion I made sure the
OpenStreetMap centerlines were split at all intersections.
Running the code below gives me INF as the output to the dist_map returned
from the shortest_path request.
What diagnostics might i try to check the traversal of my network?
Running this on the Shapefile used to create the GT, I am able to use QGIS
to produce the shortest_path - see screenshot attached.
!ScreenShot2018-11-29at1.54.38PM2.png|1019x622
I'd be glad to post my GT file somewhere if others wanted to poke at this
Thank you in advance,
Cord Thomas
Code:
from graph_tool import util as gutil
from graph_tool import topology as gtopo
from graph_tool.all import *
g = Graph(directed=False)
g.load('/ds/data/spatial/Network/streets/
tl_2016_06000_roads_la_clipped_extended_split.gt')
vertex_geoid = g.vertex_properties["geoid"]
vertices = gutil.find_vertex(g, vertex_geoid, '060372760005003')
start_vertex = vertices[0]
vertices = gutil.find_vertex(g, vertex_geoid, '060377019023041')
end_vertex = vertices[0]
dist_map = gtopo.shortest_distance(g, source=start_vertex,
target=end_vertex, weights=g.edge_properties['weight_dist'])
dist_map
returns inf
output of some data for verification:
start_vertex
<Vertex object with index '7783' at 0x7f91c35693f0>
end_vertex
<Vertex object with index '11265' at 0x7f91c35696f0>
g.num_edges()
560517
g.num_vertices()
549021
attachment.html (8.59 KB)