Hi, I just started working with UrbanAccess and had the following code working earlier today. I started cleaning it up and then of course it stopped working. I figured I'd post here rather than start a new thread. Hope that is ok. It crashes on the last line and gives me this message:
[error [error src/contraction_hierarchies/src/libch.cpp:368[error ] src/contraction_hierarchies/src/libch.cpp:368POI Category is out of Bounds]
An internal error has occurred in the Interactive window. Please restart Visual Studio.
POI Category is out of Bounds[error src/contraction_hierarchies/src/libch.cpp:[error src/contraction_hierarchies/src/libch.cpp:368] POI Category is out of Bounds
The Python REPL process has exited
Can you see anything wrong? I saved the pandana network from when it was working and it still works if i load that network back in. The GTFS data can be found here:
https://file.ac/-LhHHOc0HaA/
import urbanaccess as ua
import pandas as pd
import pandana as pdna
# GTFS
gtfs_df = ua.gtfs.load.gtfsfeed_to_df(r'D:\stefan\Isochrone\repository\gtfs',
validation=False, verbose=True,
bbox=(-122.5411,47.0845,-121.0657,47.7803),
remove_stops_outsidebbox=True,
append_definitions=False)
ua_net = ua.gtfs.network.create_transit_net(gtfs_df,
day='monday',
timerange=["06:00:00","09:00:00"],
overwrite_existing_stop_times_int=False,
use_existing_stop_times_int=True,
save_processed_gtfs=False,
save_dir='data',
save_filename=None)
ua.gtfs.headways.headways(gtfs_df,["06:00:00","09:00:00"])
# OSM:
osm_data = ua.osm.load.ua_network_from_bbox(bbox=(-122.5411,47.0845,-121.0657,47.7803),
network_type='walk',
timeout=180,
memory=None,
max_query_area_size=2500000000L,
remove_lcn=True)
ua_net = ua.osm.network.create_osm_net(osm_edges=osm_data[1], osm_nodes=osm_data[0], travel_speed_mph=3, network_type='walk')
# Integrate the network
ua_integrated_net = ua.network.integrate_network(ua_net,
headways=True,
urbanaccess_gtfsfeeds_df=gtfs_df,
headway_statistic='mean')
ua.network._format_pandana_edges_nodes(ua_integrated_net.net_edges, ua_integrated_net.net_nodes)
# Create a pandana network
imp = pd.DataFrame(ua_integrated_net.net_edges['weight'])
pdna_net = pdna.network.Network(ua_integrated_net.net_nodes.x, ua_integrated_net.net_nodes.y,
ua_integrated_net.net_edges.from_int, ua_integrated_net.net_edges.to_int, imp, False)
#pdna_net.save_hdf5('D:/stefan/Isochrone/repository/UrbanAccess/pdna_integrated_net.h5')
#pdna_net2 = pdna.Network.from_hdf5('D:/stefan/Isochrone/repository/UrbanAccess/pdna_integrated_net.h5')
dist = 30
pdna_net.init_pois(1, dist, 1)
#-122.337999,47.613309,-122.336969,47.614235
x = pd.Series(-122.355)
y = pd.Series(47.687)
#Set as a point of interest on the pandana network
pdna_net.set_pois('tstop', x, y)
#Find distance to point from all nodes, everything over max_dist gets a value of 99999
res = pdna_net.nearest_pois(dist, 'tstop', num_pois=1, max_distance=99999)
Thanks!
-Stefan