import%20marimo%0A%0A__generated_with%20%3D%20%220.23.13%22%0Aapp%20%3D%20marimo.App()%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20import%20marimo%20as%20mo%0A%0A%20%20%20%20return%20(mo%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%20Convert%20a%20Network%20from%20osmnx%0A%0A%20%20%20%20Convert%20a%20network%20from%20%60osmnx%60%20to%20a%20%60cityseer%60%20compatible%20%60networkx%60%20graph.%0A%0A%20%20%20%20Network%20data%20%C2%A9%20%5BOpenStreetMap%5D(https%3A%2F%2Fwww.openstreetmap.org%2Fcopyright)%20contributors%2C%20available%20under%20the%20Open%20Database%20Licence.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20import%20osmnx%20as%20ox%0A%20%20%20%20from%20cityseer.tools%20import%20io%2C%20plot%0A%0A%20%20%20%20return%20io%2C%20ox%2C%20plot%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20Use%20one%20of%20the%20available%20%60osmnx%60%20methods%20to%20create%20a%20%60networkx%60%20graph.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(ox)%3A%0A%20%20%20%20lng%2C%20lat%20%3D%20-0.14115725966109327%2C%2051.509220662095714%0A%20%20%20%20buff%20%3D%20500%0A%0A%20%20%20%20multi_di_graph%20%3D%20ox.graph_from_point((lat%2C%20lng)%2C%20dist%3Dbuff%2C%20simplify%3DTrue)%0A%20%20%20%20print(multi_di_graph)%0A%20%20%20%20return%20(multi_di_graph%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20Use%20the%20%5B%60nx_from_osm_nx%60%5D(https%3A%2F%2Fcityseer.benchmarkurbanism.com%2Ftools%2Fio%23nx-from-osm-nx)%20function%20from%20the%20%60cityseer%60%20%60io%60%20module%20to%20convert%20the%20%60osmnx%60%20dataset%20to%20a%20%60cityseer%60%20compatible%20%60networkx%60%20graph.%20By%20default%20the%20result%20is%20an%20undirected%20%60MultiGraph%60%2C%20appropriate%20for%20pedestrian%20analysis%3B%20pass%20%60directed%3DTrue%60%20to%20preserve%20one-way%20directionality%20for%20cycling%20or%20vehicular%20analysis.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(io%2C%20multi_di_graph%2C%20plot)%3A%0A%20%20%20%20G%20%3D%20io.nx_from_osm_nx(multi_di_graph)%0A%20%20%20%20print(G)%0A%20%20%20%20plot.plot_nx(G%2C%20plot_geoms%3DTrue)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Conclusion%0A%0A%20%20%20%20This%20notebook%20demonstrated%20how%20to%20convert%20an%20%60osmnx%60%20MultiDiGraph%20into%20a%20%60cityseer%60-compatible%20%60networkx%60%20MultiGraph%20using%20the%20%60nx_from_osm_nx%60%20function.%20This%20allows%20you%20to%20leverage%20%60osmnx%60%20for%20network%20retrieval%20while%20using%20%60cityseer%60%20for%20downstream%20analysis%20such%20as%20centrality%20and%20accessibility%20computations.%0A%0A%20%20%20%20To%20continue%20into%20analysis%2C%20hand%20the%20prepared%20graph%20to%20the%20high-level%20API%20with%20%5B%60CityNetwork.from_nx%60%5D(https%3A%2F%2Fcityseer.benchmarkurbanism.com%2Fapi%2Fnetwork%23from_nx)%2C%20which%20builds%20the%20dual%20network%20and%20exposes%20the%20centrality%20and%20land-use%20methods.%0A%0A%20%20%20%20**Next%20steps%3A**%20See%20also%20%5Bmomepy%20conversion%5D(https%3A%2F%2Fcityseer.benchmarkurbanism.com%2Fexamples%2Fnetworks%2Fmomepy-to-cityseer)%20or%20proceed%20to%20%5BNetwork%20Centrality%5D(https%3A%2F%2Fcityseer.benchmarkurbanism.com%2Fexamples%2Fcentrality)%20to%20compute%20metrics.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20app.run()%0A
1afc198d525f034ffa5ba04e4992fcac