momepy.get_network_ratio

momepy.get_network_ratio(df, edges, initial_buffer=500)[source]

Link polygons to network edges based on the proportion of overlap (if a cell intersects more than one edge). Useful if you need to link enclosed tessellation to street network. Ratios can be used as weights when linking network-based values to cells. For a purely distance-based link use momepy.get_nearest_street(). Links are based on the integer position of edge (iloc).

Parameters:
df : GeoDataFrame

A GeoDataFrame containing objects to snap (typically enclosed tessellation).

edges : GeoDataFrame

A GeoDataFrame containing a street network.

initial_buffer : float

The initial buffer used to link non-intersecting cells.

Returns:

result – The resultant DataFrame.

Return type:

DataFrame

See also

momepy.get_node_id

Examples

>>> links = mm.get_network_ratio(enclosed_tessellation, streets)
>>> links.head()
  edgeID_keys                              edgeID_values
0        [34]                                      [1.0]
1     [0, 34]  [0.38508998545027145, 0.6149100145497285]
2        [32]                                        [1]
3         [0]                                      [1.0]
4        [26]                                        [1]