# momepy API reference¶

## elements¶

 Blocks(tessellation, edges, buildings, …) Generate blocks based on buildings, tesselation and street network buffered_limit(gdf[, buffer]) Define limit for tessellation as a buffer around buildings. get_network_id(left, right, network_id[, …]) Snap each element (preferably building) to the closest street network segment, saves its id. get_node_id(objects, nodes, edges, node_id, …) Snap each building to closest street network node on the closest network edge. Tessellation(gdf, unique_id, limit[, …]) Generate morphological tessellation around given buildings or proximity bands around given street network.

## dimension¶

 Area(gdf) Calculates area of each object in given GeoDataFrame. AverageCharacter(gdf, values, …[, rng, mode]) Calculates the average of a character within k steps of morphological tessellation CourtyardArea(gdf[, areas]) Calculates area of holes within geometry - area of courtyards. CoveredArea(gdf, spatial_weights, unique_id) Calculates the area covered by neighbours FloorArea(gdf, heights[, areas]) Calculates floor area of each object based on height and area. Calculates the length of the longest axis of object. Perimeter(gdf) Calculates perimeter of each object in given GeoDataFrame. PerimeterWall(gdf[, spatial_weights]) Calculate the perimeter wall length the joined structure. SegmentsLength(gdf[, spatial_weights, mean]) Calculate the cummulative or mean length of segments. StreetProfile(left, right[, heights, …]) Calculates the street profile characters. Volume(gdf, heights[, areas]) Calculates volume of each object in given GeoDataFrame based on its height and area. WeightedCharacter(gdf, values, …[, areas]) Calculates the weighted character

## shape¶

 Calculates mean distance centroid - corners and st. CircularCompactness(gdf[, areas]) Calculates compactness index of each object in given geoDataFrame. CompactnessWeightedAxis(gdf[, areas, …]) Calculates compactness-weighted axis of each object in given geoDataFrame. Convexeity(gdf[, areas]) Calculates convexeity index of each object in given geoDataFrame. Corners(gdf) Calculates number of corners of each object in given geoDataFrame. CourtyardIndex(gdf, courtyard_areas[, areas]) Calculates courtyard index of each object in given geoDataFrame. Elongation(gdf) Calculates elongation of object seen as elongation of its minimum bounding rectangle. EquivalentRectangularIndex(gdf[, areas, …]) Calculates equivalent rectangular index of each object in given geoDataFrame. FormFactor(gdf, volumes[, areas]) Calculates form factor of each object in given geoDataFrame. FractalDimension(gdf[, areas, perimeters]) Calculates fractal dimension of each object in given geoDataFrame. Linearity(gdf) Calculates linearity of each LineString object in given geoDataFrame. Rectangularity(gdf[, areas]) Calculates rectangularity of each object in given geoDataFrame. ShapeIndex(gdf, longest_axis[, areas]) Calculates shape index of each object in given geoDataFrame. SquareCompactness(gdf[, areas, perimeters]) Calculates compactness index of each object in given geoDataFrame. Squareness(gdf) Calculates squareness of each object in given geoDataFrame. VolumeFacadeRatio(gdf, heights[, volumes, …]) Calculates volume/facade ratio of each object in given geoDataFrame.

## spatial distribution¶

 Alignment(gdf, spatial_weights, unique_id, …) Calculate the mean deviation of solar orientation of objects on adjacent cells from an object BuildingAdjacency(gdf, …[, spatial_weights]) Calculate the level of building adjacency CellAlignment(left, right, …) Calculate the difference between cell orientation and orientation of object MeanInterbuildingDistance(gdf, …[, …]) Calculate the mean interbuilding distance NeighborDistance(gdf, spatial_weights, unique_id) Calculate the mean distance to adjacent buildings (based on spatial_weights) Calculate the mean deviation of solar orientation of adjacent streets Neighbors(gdf, spatial_weights, unique_id[, …]) Calculate the number of neighbours captured by spatial_weights Calculate the orientation of object SharedWallsRatio(gdf, unique_id[, perimeters]) Calculate shared walls ratio of adjacent elements (typically buildings) StreetAlignment(left, right, orientations[, …]) Calculate the difference between street orientation and orientation of object in degrees

## intensity¶

 AreaRatio(left, right, left_areas, right_areas) Calculate covered area ratio or floor area ratio of objects. BlocksCount(gdf, block_id, spatial_weights, …) Calculates the weighted number of blocks Count(left, right, left_id, right_id[, weighted]) Calculate the number of elements within an aggregated structure. Courtyards(gdf, block_id[, spatial_weights]) Calculate the number of courtyards within the joined structure. Density(gdf, values, spatial_weights, unique_id) Calculate the gross density NodeDensity(left, right, spatial_weights[, …]) Calculate the density of nodes neighbours on street network defined in spatial_weights. Reached(left, right, left_id, right_id[, …]) Calculates the number of objects reached within neighbours on street network

## graph¶

 betweenness_centrality(graph[, name, mode, …]) Calculates the shortest-path betweenness centrality for nodes. cds_length(graph[, radius, mode, name, …]) Calculates length of cul-de-sacs for subgraph around each node. closeness_centrality(graph[, name, weight]) Calculates the closeness centrality for nodes. clustering(graph[, name]) Calculates the squares clustering coefficient for nodes. cyclomatic(graph[, radius, name, distance]) Calculates cyclomatic complexity for subgraph around each node. edge_node_ratio(graph[, radius, name, distance]) Calculates edge / node ratio for subgraph around each node. gamma(graph[, radius, name, distance]) Calculates connectivity gamma index for subgraph around each node. local_betweenness_centrality(graph[, …]) Calculates the shortest-path betweenness centrality for nodes within subgraph. local_closeness_centrality(graph[, radius, …]) Calculates local closeness for each node based on the defined distance. local_straightness_centrality(graph[, …]) Calculates local straightness for each node based on the defined distance. mean_node_degree(graph[, radius, name, …]) Calculates mean node degree for subgraph around each node. mean_node_dist(graph[, name, length]) Calculates mean distance to neighbouring nodes. mean_nodes(G, attr) Calculates mean value of nodes attr for each edge. meshedness(graph[, radius, name, distance]) Calculates meshedness for subgraph around each node. node_degree(graph[, name]) Calculates node degree for each node. proportion(graph[, radius, three, four, …]) Calculates the proportion of intersection types for subgraph around each node. straightness_centrality(graph[, weight, …]) Calculates the straightness centrality for nodes. subgraph(graph[, radius, distance, …]) Calculates all subgraph-based characters.

## diversity¶

 Range(gdf, values, spatial_weights, unique_id) Calculates the range of values within neighbours defined in spatial_weights. Simpson(gdf, values, spatial_weights, unique_id) Calculates the Simpson’s diversity index of values within neighbours defined in spatial_weights. Theil(gdf, values, spatial_weights, unique_id) Calculates the Theil measure of inequality of values within neighbours defined in spatial_weights. Gini(gdf, values, spatial_weights, unique_id) Calculates the Gini index of values within neighbours defined in spatial_weights.

## utilities¶

 gdf_to_nx(gdf_network[, approach, length]) Convert LineString GeoDataFrame to networkx.MultiGraph limit_range(vals, rng) Extract values within selected range Check topology of street network and eliminate nodes of degree 2 by joining affected edges. nx_to_gdf(net[, points, lines, …]) Convert networkx.Graph to LineString GeoDataFrame and Point GeoDataFrame preprocess(buildings[, size, compactness, …]) Preprocesses building geometry to eliminate additional structures being single features. snap_street_network_edge(edges, buildings, …) Fix street network before performing blocks() sw_high(k[, gdf, weights, ids, contiguity, …]) Generate spatial weights based on Queen or Rook contiguity of order k. unique_id(objects) Add an attribute with unique ID to each row of GeoDataFrame.