Data Structure¶
Momepy is built on top of geopandas
GeoDataFrame objects and, for network analysis, on
networkx Graph.
For any kind of morphometric analysis, data needs to be provided as
GeoDataFrames. Results of morphometric analysis from momepy can be
generally returned as pandas Series to be added as a column of an existing
GeoDataFrame. All the details and attributes of each class are clearly
described in the API.
Morphometric Functions¶
Morphometric functions available in momepy could be divided into four
different groups based on their approach to data requirements and outputs.
Simple characters
Simple morphometric characters use a single
GeoDataFrameas a source of the data.Relational characters
Relational characters are based on relations between two or more
GeoDataFrames. A typical example isstreet_alignment, which requires both the orientation of streets and the orientation of buildings.Network analysis
Network analysis characters are based on
networkx.Graphand return anetworkx.Graphwith additional node or edge attributes.
Morphological Elements¶
Additional modules (elements and utils) cover functions generating new
morphological elements, like morphological tessellation, or links between
them. For details, please refer to the API.
The majority of functions used within momepy are not limited to one type of
morphological element. However, the whole package is built with a specific set
of elements in mind, based on the research done at the University of
Strathclyde by the Urban Design Studies Unit.
This is true especially for morphological tessellation, partitioning of space
based on building footprints. Morphological tessellation can substitute plots
for certain types of analysis and provide additional information, like
adjacency, for other analyses. More information on tessellation is in the
dedicated section of this guide.
Generally, we can work with any kind of morphological element that fits the selected function; there is no restriction. Sometimes, where documentation refers to buildings, other elements like blocks can be used as well, as long as the principle remains the same.
For example, you can use momepy to do morphometric analysis of:
buildings
plots
morphological cells
streets
street profiles
street networks
blocks
and more.
Links Between Elements¶
When using more than one morphological element, momepy needs to understand
what the relationship between them is. For this, it relies on indices of
GeoPandas objects. It is expected that every building lies on a certain plot or
morphological cell, on a certain street, or within a certain block. To use
momepy, each feature of each layer needs its own unique index. Moreover, each
feature also needs to bear the index of related elements. Consider the
following sample rows of buildings_gdf:
index |
block_index |
network_edge_index |
|---|---|---|
1 |
143 |
22 |
2 |
143 |
25 |
3 |
144 |
25 |
4 |
144 |
25 |
5 |
144 |
29 |
Each building has its own unique index, while more buildings share the
block_index of the block they belong to. In this sense, in blocks_gdf, each
feature would have its own unique index used as a reference for
buildings_gdf. In principle, elements on the smaller scale contain index
information of elements on the larger scale; blocks will not have building
index.
Momepy can link certain types of elements together.
Spatial Graphs¶
Unique indices are also used as an index within spatial graphs. Thanks to this, spatial graphs generated on morphological tessellation, like Queen contiguity, can be directly used on buildings and vice versa. Detailed information on using spatial weights within momepy will be discussed later.