Description
Currently we have 2 instances of code examples that don't actually work
Both of these are them propagated into the docs site:
I propose we make those both fully working examples and potentially include a utility function for querying and loading a network based on the stuff in Adaptive Simplification, maybe living in a utils.py
or the like.
import osmnx
def fetch_network(
place: str = "Milton Keynes", local_crs: str = 27700,
) -> geopandas.GeoDataFrame:
"""Query for network drive edges."""
osm_graph = osmnx.graph_from_place(place, network_type="drive")
osm_graph = osmnx.projection.project_graph(osm_graph, to_crs=local_crs)
return osmnx.graph_to_gdfs(
osmnx.convert.to_undirected(osm_graph),
nodes=False,
edges=True,
node_geometry=False,
fill_edge_geometry=True,
).reset_index(drop=True)
or perhaps even something more explicit like:
import osmnx
def fetch_milton_keynes() -> geopandas.GeoDataFrame:
"""Query for Milton Keynes network drive edges."""
osm_graph = osmnx.graph_from_place("Milton Keynes", network_type="drive")
osm_graph = osmnx.projection.project_graph(osm_graph, to_crs=27700)
return osmnx.graph_to_gdfs(
osmnx.convert.to_undirected(osm_graph),
nodes=False,
edges=True,
node_geometry=False,
fill_edge_geometry=True,
).reset_index(drop=True)
Do either of these seem amenable, @anastassiavybornova & @martinfleis ?