from cityseer.metrics import visibility
VGA from OSM data
Generate a visual graph analysis (VGA) from OpenStreetMap (OSM) data.
Use the visibility module to create a VGA from OSM data. The VGA will be generated based on the OSM data provided to the visibility_graph_from_osm
method.
Pay particular attention to:
- The
bounds_wgs
parameter, which defines the geographical area in longitude and latitude to analyze. The order is Left, Bottom, Right, Top. - The
out_path
parameter, which specifies where to save the output files. The filepath must exist. The extension of the output file will be.tif
and the file will be saved in GeoTIFF format, which can be opened in QGIS. - The
to_crs_code
parameter, which specifies the coordinate reference system (CRS) to use for the output. The default is the local UTM, but you can change it to any valid CRS code. - The
view_distance
andresolution
parameters, which control the analysis granularity.
There is a performance trade-off for the bounds, view_distance, and resolution. A larger view_distance or higher resolution will result in a more detailed graph but may take longer to compute and require more memory.
visibility.visibility_graph_from_osm(=(18.41077, -33.93154, 18.42755, -33.91626),
bounds_wgs="recipes/visibility/images/ct_vis",
out_path=None, # defaults to local UTM
to_crs_code=100, # can use a larger view distance - but slower
view_distance=2, # set resolution - e.g. 2m
resolution )
INFO:cityseer.metrics.visibility:Preparing buildings raster.
INFO:cityseer.metrics.visibility:Running visibility.
100%|██████████| 690999/690999 [02:40<00:00, 4305.88it/s]
The output will generate three files:
- A
density
measure - the number of visible pixels. - A
farness
measure - the summed distance to visible pixels - favours farther views (up toview_distance
). - A
harmonic
closeness measure - the summed inverse of the distance to visible pixels - favours close adjacency to open spaces.