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%20Visibility%20from%20Raster%20Data%0A%0A%20%20%20%20Generate%20a%20visibility%20analysis%20from%20raster%20data.%20This%20approach%20allows%20for%20blending%20building%20footprints%20with%20Digital%20Elevation%20Model%20(DEM)%20data%20to%20take%20elevation%20into%20account.%0A%0A%20%20%20%20Visibility%20analysis%20is%20provided%20by%20the%20standalone%20%60visibility%60%20module%3B%20it%20is%20not%20wrapped%20by%20the%20higher-level%20%60CityNetwork%60%20class.%0A%0A%20%20%20%20The%20bundled%20raster%20derives%20from%20building%20footprint%20and%20terrain%20data%3B%20sources%20and%20licensing%20are%20documented%20on%20the%20%5Bdatasets%20page%5D(https%3A%2F%2Fcityseer.benchmarkurbanism.com%2Fexamples%2Fdatasets).%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.metrics%20import%20visibility%0A%0A%20%20%20%20return%20(visibility%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%60visibility.visibility_from_raster%60%5D(https%3A%2F%2Fcityseer.benchmarkurbanism.com%2Fmetrics%2Fvisibility%23visibility_from_raster)%20method%20to%20run%20a%20visibility%20analysis%20over%20the%20provided%20raster.%0A%0A%20%20%20%20Pay%20particular%20attention%20to%3A%0A%0A%20%20%20%20-%20The%20%60input_path%60%20parameter%2C%20which%20specifies%20the%20path%20to%20the%20input%20raster%20file.%20The%20file%20must%20exist%20and%20be%20in%20a%20format%20readable%20by%20%60rasterio%60%2C%20such%20as%20GeoTIFF.%20The%20resolution%20is%20inferred%20from%20the%20raster.%0A%20%20%20%20-%20The%20%60out_path%60%20parameter%2C%20which%20specifies%20where%20to%20save%20the%20output%20files.%20The%20directory%20must%20exist.%20Outputs%20are%20written%20in%20GeoTIFF%20format%20(%60.tif%60)%2C%20which%20can%20be%20opened%20in%20QGIS.%0A%0A%20%20%20%20There%20is%20a%20performance%20trade-off%20between%20the%20view%20distance%20and%20the%20input%20raster%20resolution%3A%20a%20larger%20view%20distance%20or%20finer%20resolution%20gives%20more%20detailed%20output%20but%20takes%20longer%20to%20compute%20and%20requires%20more%20memory.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(visibility)%3A%0A%20%20%20%20visibility.visibility_from_raster(%0A%20%20%20%20%20%20%20%20%22images%2Fmadrid_rast_ht.tif%22%2C%0A%20%20%20%20%20%20%20%20%22images%2Fmadrid_vis_from_rast%22%2C%0A%20%20%20%20%20%20%20%20view_distance%3D100%2C%0A%20%20%20%20%20%20%20%20observer_height%3D1.5%2C%0A%20%20%20%20)%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%20The%20output%20below%20shows%20the%20%60harmonic%60%20measure%20computed%20from%20a%20building%20raster%20that%20includes%20rooftop%20heights.%20No%20DEM%20data%20is%20used%20in%20this%20example.%0A%20%20%20%20%22%22%22)%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%3Cimg%20src%3D%22images%2Fmadrid_harmonic_100_2.png%22%20style%3D%22width%3A100%25%3B%22%3E%0A%20%20%20%20%22%22%22)%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%20generated%20a%20visibility%20analysis%20from%20raster%20data%20using%20%60visibility_from_raster%60%2C%20which%20can%20incorporate%20building%20heights%20and%20Digital%20Elevation%20Model%20(DEM)%20data%20to%20account%20for%20terrain.%20The%20%60observer_height%60%20parameter%20simulates%20pedestrian-level%20views%2C%20and%20the%20output%20rasters%20(density%2C%20farness%2C%20harmonic)%20capture%20visibility%20patterns%20influenced%20by%20both%20buildings%20and%20topography.%0A%0A%20%20%20%20**Next%20steps%3A**%20For%20street%20continuity%20analysis%2C%20see%20%5BContinuity%20from%20OSM%5D(https%3A%2F%2Fcityseer.benchmarkurbanism.com%2Fexamples%2Fcontinuity%2Fcontinuity-osm).%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
93919cf86690b3f5668f9961243975d5