momepy API reference

elements

Blocks(tessellation, edges, buildings, ...)

Generate blocks based on buildings, tesselation and street network.

buffered_limit(gdf[, buffer])

Define limit for momepy.Tessellation as a buffer around buildings.

COINS(edge_gdf[, angle_threshold])

Calculates natural continuity and hierarchy of street networks in given GeoDataFrame using COINS algorithm.

enclosures(primary_barriers[, limit, ...])

Generate enclosures based on passed barriers.

get_network_id(left, right, network_id[, ...])

Snap each element (preferably building) to the closest street network segment, saves its id.

get_network_ratio(df, edges[, initial_buffer])

Link polygons to network edges based on the proportion of overlap (if a cell intersects more than one edge)

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, ...])

Generates tessellation.

dimension

Area(gdf)

Calculates area of each object in given GeoDataFrame.

AverageCharacter(gdf, values, ...[, rng, ...])

Calculates the average of a character within a set neighbourhood defined in spatial_weights

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.

LongestAxisLength(gdf)

Calculates the length of the longest axis of object.

Perimeter(gdf)

Calculates perimeter of each object in given GeoDataFrame.

PerimeterWall(gdf[, spatial_weights, verbose])

Calculate the perimeter wall length the joined structure.

SegmentsLength(gdf[, spatial_weights, mean, ...])

Calculate the cummulative and/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

CentroidCorners(gdf[, verbose])

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.

Convexity(gdf[, areas])

Calculates Convexity index of each object in given GeoDataFrame.

Corners(gdf[, verbose])

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[, verbose])

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[, verbose])

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, ...[, ...])

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)

NeighboringStreetOrientationDeviation(gdf)

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

Orientation(gdf[, verbose])

Calculate the orientation of object

SharedWalls(gdf)

Calculate the length of shared walls of adjacent elements (typically buildings)

SharedWallsRatio(gdf[, 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[, spatial_weights, verbose])

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 if radius is set, or for whole graph, if radius=None.

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 if radius is set, or for whole graph, if radius=None.

edge_node_ratio(graph[, radius, name, ...])

Calculates edge / node ratio for subgraph around each node if radius is set, or for whole graph, if radius=None.

gamma(graph[, radius, name, distance, verbose])

Calculates connectivity gamma index for subgraph around each node if radius is set, or for whole graph, if radius=None.

mean_node_degree(graph[, radius, name, ...])

Calculates mean node degree for subgraph around each node if radius is set, or for whole graph, if radius=None.

mean_node_dist(graph[, name, length, verbose])

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 if radius is set, or for whole graph, if radius=None.

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 if radius is set, or for whole graph, if radius=None.

straightness_centrality(graph[, weight, ...])

Calculates the straightness centrality for nodes.

subgraph(graph[, radius, distance, ...])

Calculates all subgraph-based characters.

diversity

Gini(gdf, values, spatial_weights, unique_id)

Calculates the Gini index of values within neighbours defined in spatial_weights.

Percentiles(gdf, values, spatial_weights, ...)

Calculates the percentiles of values within neighbours defined in spatial_weights.

Range(gdf, values, spatial_weights, unique_id)

Calculates the range of values within neighbours defined in spatial_weights.

Shannon(gdf, values, spatial_weights, unique_id)

Calculates the Shannon index 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.

Unique(gdf, values, spatial_weights, unique_id)

Calculates the number of unique values within neighbours defined in spatial_weights.

shannon_diversity(data[, bins, categorical, ...])

Calculates the Shannon's diversity index of data.

simpson_diversity(data[, bins, categorical, ...])

Calculates the Simpson's diversity index of data.

spatial weights

DistanceBand(gdf, threshold[, centroid, ids])

On demand distance-based spatial weights-like class.

sw_high(k[, gdf, weights, ids, contiguity, ...])

Generate spatial weights based on Queen or Rook contiguity of order k.

preprocessing

close_gaps(gdf, tolerance)

Close gaps in LineString geometry where it should be contiguous.

CheckTessellationInput(gdf[, shrink, ...])

Check input data for Tessellation for potential errors.

extend_lines(gdf, tolerance[, target, ...])

Extends lines from gdf to itself or target within a set tolerance

remove_false_nodes(gdf)

Clean topology of existing LineString geometry by removal of nodes of degree 2.

preprocess(buildings[, size, compactness, ...])

Preprocesses building geometry to eliminate additional structures being single features.

utilities

gdf_to_nx(gdf_network[, approach, length, ...])

Convert LineString GeoDataFrame to networkx.MultiGraph or other Graph as per specification.

limit_range(vals, rng)

Extract values within selected range

nx_to_gdf(net[, points, lines, ...])

Convert networkx.Graph to LineString GeoDataFrame and Point GeoDataFrame.

unique_id(objects)

Add an attribute with unique ID to each row of GeoDataFrame.