cityImage API reference#
angles#
|
The function returns the coordinates of the line starting from a tuple of coordinates, which forms with the y axis an angle in degree of a certain magnitude, given the distance from the origin. |
|
Given two LineStrings it computes the angle between them. |
Barriers#
|
The function downloads major roads from OSM. |
|
The function downloads water bodies from OSM. |
|
The function downloads overground railway structures from OSM. |
|
The function downloads parks areas with a certain extent and converts them to LineString features. |
|
The function assigns to each street segment in a GeoDataFrame the list of barrierIDs corresponding to waterbodies which lay along the street segment. |
|
The function assigns to each street segment in a GeoDataFrame the list of barrierIDs corresponding to parks which lie along the street segments. |
|
The function returns list of barrierIDs along the edgeID of a street segment, given a certain offset. |
|
The function return a GeoDataFrame with an added boolean column field that indicates whether the street segment intersects a separating/structuring barrier. |
|
The function returns all the barriers (water, park, railways, major roads) within a certain urban area. |
centrality#
|
Calculates the reach centrality of each node in the graph G based on the attribute of the reachable nodes within a given radius. |
|
Straightness centrality compares the length of the path between two nodes with the straight line that links them capturing a centrality that refers to ‘being more directly reachable’. |
|
Given a nodes' and a services/points' GeoDataFrame, the function assigns an attribute to nodes in the graph G (prevously derived from nodes_gdf) based on the amount of features in the services_gdf in a buffer around each node. |
|
" |
clean#
|
It calls a series of functions to clean nodes and edges GeoDataFrames. It handles: - pseudo-nodes; - duplicate-geometries (nodes and edges); - disconnected islands - optional; - edges with different geometry but same nodes - optional; - dead-ends - optional; - self-loops - optional; - toplogy issues - optional. |
|
The function identify pseudo-nodes, namely nodes that represent intersection between only 2 segments. |
|
The function checks the existencce of duplicate nodes through the network, on the basis of geometry. |
|
The function removes dead-ends. |
|
The function checks the presence of pseudo-junctions, by using the edges_gdf GeoDataFrame. |
|
The function checks the presence of possible duplicate geometries in the edges_gdf GeoDataFrame. |
|
Merge pseudo-edges by updating node and edge information in the corresponding GeoDataFrames. |
|
This function is used to simplify edges that have the same start and end point (i.e. |
|
Fix the network topology by splitting intersecting edges and adding fixed edges to the network. |
|
Fix the network topology by removing (fake) self-loops and adding fixed edges. |
|
Remove disconnected islands from a graph. |
|
The function adjusts the edges LineString coordinates consistently with their relative u and v nodes' coordinates. |
colors#
|
Generates a list of random HSV colors given the number of classes, minimum and maximum values in the HSV spectrum. |
|
It generates a categorical random color map, given the number of classes |
It returns a Kindlmann color map. |
|
|
Normalizes a value n from one range to another range. |
|
Lightens the given color by multiplying (1-luminosity) by the given amount. |
graph#
|
From two GeoDataFrames (nodes and edges), it creates a NetworkX undirected Graph. |
|
From two GeoDataFrames (nodes and edges), it creates a NetworkX.MultiGraph. |
|
It creates two dataframes that are later exploited to generate the dual graph of a street network. |
|
The function generates a NetworkX.Graph from dual-nodes and -edges GeoDataFrames. |
|
It can be used when one deals with a dual graph and wants to link analyses conducted on this representation to the primal graph. |
|
It returns a dictionary where keys are nodes identifier (e.g. |
land_use#
|
The function reclassifies land-use descriptors in a land-use field according to the categorisation presented below. |
|
It assigns land-use attributes to buildings in a buildings GeoDataFrame, looking for possible matches in "other_gdf", a Polygon or Point GeoDataFrame Polygon: Possible matches here means the buildings in "other_gdf" whose area of interesection with the examined building (y), covers at least 60% of the building's (y) area. |
landmarks#
|
The function take a building footprint .shp or .gpkg, returns two GDFs of buildings: the case-study area, plus a larger area containing other buildings, called "obstructions" (for analyses which include adjacent buildings). |
|
The function downloads and cleans building footprint geometries and create a buildings GeoDataFrames for the area of interest. |
|
The function computes the "Structural Landmark Component" sub-scores of each building. |
|
The function counts the number of neighbours, in a GeoDataFrame, around a given geometry, within a research radius. |
|
The function calculates the sub-scores of the "Visibility Landmark Component". |
|
Compute the approximate facade area of a building given its geometry and height. |
|
The function downloads and cleans building footprint geometries and create a buildings GeoDataFrames for the area of interest. |
|
The function computes the "Cultural Landmark Component" based on the number of features listed in historical/cultural landmarks datasets. |
|
The function computes the "Pragmatic Landmark Component" based on the frequency, and therefore unexpectedness, of a land_use class in an area around a building. |
|
Computes the component and global scores for a buildings GeoDataFrame, rescaling values when necessary and assigning weights to the different properties measured. |
|
The function computes landmarkness at the local level. |
load#
|
The function downloads and creates a simplified OSMNx graph for a selected area's street network. |
|
The function loads a vector lines from a specified directory, along with the epsg coordinate code. |
|
The function loads a vector lines shapefile from a given LineString GeoDataFrame, along with the epsg coordinate code. |
|
It obtains the nodes GeoDataFrame from the unique coordinates pairs in the edges_gdf GeoDataFrame. |
|
The function merge the u-v nodes information, from the nodes GeoDataFrame, with the edges_gdf GeoDataFrame. |
|
The function simply resets the indexes of the two dataframes. |
plot#
|
It plots the geometries of a single GeoDataFrame, coloring on the bases of the values contained in column, using a given scheme. |
|
It plots the geometries of different GeoDataFrames, coloring on the bases of the values contained in the provided column, using a given scheme. |
|
It plots the geometries of a GeoDataFrame, coloring on the bases of the values contained in two or more provided columns, using a given scheme. |
regions#
|
It identifies regions in the street network, using the dual graph representation. |
|
It identifies regions in the street network, using the primal graph representation. |
|
Given districts assign to street segments it create polygons representing districts, either by creating a convex_hull for each group of segments or simply polygonising them. |
|
It assigns districts' identifiers to the street junctions (nodes), when the districts are assigned to the street segments (edges), i.e. communities are identified on the dual graph. |
|
It assigns districts' identifiers to the street segments (edges), when the districts are assigned to the junctions(nodes), i.e. communities are identified on the primal graph. |
|
It assigns districts' identifiers to the street junctions (nodes), from polygons representing district areas. |
|
Amend the membership of nodes to districts based on connectivity and minimum district size. |
|
This function identifies junctions lying on the boundary of a district, thus connected to other districts through "bridge" edges. |
utilities#
|
The function downloads certain geometries from OSM, by means of OSMNX functions. |
|
Rescales the values in a dataframe's column from 0 to 1 or from 1 to 0. |
|
It takes a list of dictionaries and creates from them a pandas DataFrame. |
|
Given two LineStrings, it derives the corresponding center line |
|
Given a geometry and a GeoDataFrame, it returns the minimum distance between the geometry and the GeoDataFrame. |
|
The function checks whether the coordinates of one or more Points in a Point Collections are part of the sequence of coordinates of a LineString. |
|
Given a list of LineString geometries, this function reorders the geometries in the correct sequence based on their starting and ending points, and returns a merged LineString feature. |
|
Given a GeoDataFrame it derives its envelope in the WGS coordinate system. |
|
Given a GeoDataFrame it derives its convex hull in the WGS coordinate system. |
|
Given a value n and the range which it belongs to, the function rescale the value, between a different range. |
|
The function creates a GeoDataFrame from a list of geometries. |
|
Given a LineString, it creates a perpendicular LineString that intersects the given geometry at its centroid. |
|
Given a LineString geometry, it sums the column values of all the features in a LineString GeoDataFrame intersecting the line. |
The function extracts the individual parts of the multi-part geometries and creates a new GeoDataFrame with single part geometries. |
|
Fixes MultiLineString geometries in a GeoDataFrame by merging them into LineString geometries. |
|
For each cell in the DataFrame, if the cell contains a list, update it to keep only the first element of the list. |
|
|
Convert a 2D polygon to a 3D polygon. |
visibility#
|
It creates a 2d polygon of visibility around a polygon geometry (e.g. |
|
Computes the 3D sight lines between observer points in a Point GeoDataFrame and target buildings, based on a given distance along the buildings' exterior and a minimum distance between observer and target (e.g. |
|
Check if a 3d line of sight between two points is obstructed by any buildings. |