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%20OSM%20Network%20from%20a%20Buffered%20Coordinate%0A%0A%20%20%20%20Use%20a%20buffered%20point%20to%20create%20a%20%60networkx%60%20graph%20from%20OSM.%0A%0A%20%20%20%20Use%20this%20approach%20when%20you%20have%20a%20centre-point%2C%20such%20as%20a%20longitude%20and%20latitude%2C%20and%20you%20wish%20to%20create%20a%20network%20within%20a%20certain%20radius%20distance.%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%20from%20cityseer.tools%20import%20io%2C%20plot%0A%0A%20%20%20%20return%20io%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%20Define%20a%20longitude%20and%20latitude%2C%20and%20a%20buffer%20distance%20in%20meters.%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%20lng%2C%20lat%20%3D%20-0.13396079424572427%2C%2051.51371088849723%0A%20%20%20%20buffer%20%3D%20500%0A%20%20%20%20return%20buffer%2C%20lat%2C%20lng%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%20A%20geometry%20can%20now%20be%20created%20using%20the%20%5B%60buffered_point_poly%60%5D(https%3A%2F%2Fcityseer.benchmarkurbanism.com%2Ftools%2Fio%23buffered-point-poly)%20function%20available%20from%20the%20%60cityseer%60%20package's%20%60io%60%20module.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(buffer%2C%20io%2C%20lat%2C%20lng)%3A%0A%20%20%20%20poly_wgs%2C%20epsg_code%20%3D%20io.buffered_point_poly(lng%2C%20lat%2C%20buffer)%0A%20%20%20%20print(epsg_code)%0A%20%20%20%20poly_wgs%0A%20%20%20%20return%20(poly_wgs%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%20You%20can%20then%20use%20this%20geometry%20to%20specify%20the%20boundaries%20to%20be%20used%20for%20creating%20a%20network%20using%20the%20%5Bosm_graph_from_poly%5D(https%3A%2F%2Fcityseer.benchmarkurbanism.com%2Ftools%2Fio%23osm-graph-from-poly)%20function.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(io%2C%20plot%2C%20poly_wgs)%3A%0A%20%20%20%20G%20%3D%20io.osm_graph_from_poly(poly_wgs%2C%20green_footways%3DFalse)%20%20%23%20False%20by%20default%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%20Set%20the%20%60projected%60%20parameter%20to%20%60True%60%20if%20you%20would%20rather%20use%20the%20local%20UTM%20projection%20for%20the%20boundary.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(buffer%2C%20io%2C%20lat%2C%20lng)%3A%0A%20%20%20%20poly_utm%2C%20epsg_code_1%20%3D%20io.buffered_point_poly(lng%2C%20lat%2C%20buffer%2C%20projected%3DTrue)%0A%20%20%20%20print(epsg_code_1)%0A%20%20%20%20poly_utm%0A%20%20%20%20return%20epsg_code_1%2C%20poly_utm%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%20In%20this%20case%2C%20remember%20to%20set%20the%20%60poly_crs_code%60%20parameter%20to%20the%20appropriate%20UTM%20CRS%20if%20using%20the%20resultant%20geometry%20as%20a%20parameter%20for%20the%20%5Bosm_graph_from_poly%5D(https%3A%2F%2Fcityseer.benchmarkurbanism.com%2Ftools%2Fio%23osm-graph-from-poly)%20function.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(epsg_code_1%2C%20io%2C%20plot%2C%20poly_utm)%3A%0A%20%20%20%20G_utm%20%3D%20io.osm_graph_from_poly(poly_utm%2C%20poly_crs_code%3Depsg_code_1)%0A%20%20%20%20print(G_utm)%0A%20%20%20%20plot.plot_nx(G_utm%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%20create%20a%20street%20network%20graph%20from%20OpenStreetMap%20by%20buffering%20a%20longitude%2Flatitude%20coordinate%20to%20a%20specified%20radius%20using%20%60buffered_point_poly%60.%20This%20approach%20is%20useful%20when%20you%20have%20a%20centre-point%20and%20want%20to%20extract%20the%20surrounding%20network%20within%20a%20given%20distance%2C%20with%20options%20for%20both%20WGS84%20and%20projected%20UTM%20boundaries.%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**%20To%20use%20a%20custom%20boundary%20file%20instead%2C%20see%20%5BBoundary%20File%5D(https%3A%2F%2Fcityseer.benchmarkurbanism.com%2Fexamples%2Fnetworks%2Fnetwork-from-bounds).%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
b762be170a8b0abbb8b575641c1c4241