exporting to geopackages
Closed this issue · 0 comments
josephholler commented
g_nodes, g_edges = ox.graph_to_gdfs(
G,
nodes=True, edges=True,
node_geometry=True,
fill_edge_geometry=True)
g_nodes
%%time
g_nodes_hex = gpd.sjoin(g_nodes, grid_file[["id","geometry"]].to_crs(4326), how="left", op="intersects")
#g_nodes_hex.group_by(by="id").agg(
# hexnodes = pd.NamedAgg(column="osmid", aggfunction=count))
g_nodes_hex['id'].value_counts()
ox.save_graphml(G, "ord_cleaned.graphml")
g_nodes.to_file("data/ord_network.gpkg", layer='nodes', driver="GPKG")
g_edges[["maxspeed","geometry"]].to_file("data/ord_edges.gpkg", layer='edges', driver="GPKG")
grid_file.to_file("data/grid.gpkg", layer="hex", driver="GPKG")
# there are definitely problems with the maxspeed data
# e.g. sections of highway that are now set to 35 mph
# whereas teh osmnx function would set maxspeed according to
# similar highway types
# also chicago hexagons are small enough that many have no nodes
# additionally curious what happens to the lowest 5th class on the choropleth maps?