get_borders(gdf, geo_field='geometry')

Calculates bordering regions for all regions using Queen contiguity (i.e. neighbours share either a corner or an edge).

Similar to a Moore neighbourhood, Queen contiguity determines a neighbour as a region that shares an edge or vertex with the focal region.

Weights are assigned to each focal, neighbour pair using libpysal.weights.Queen. The weights are based on the amount of a focal region's perimeter is occupied by the neighbour region.

Parameters
  • gdf : geopandas.GeoDataFrame - A dataset that you want to find all borders for
  • geo_field : string, optional, default 'geometry' - Field containing the geometries of each region
Returns
  • pandas.DataFrame - DataFrame where each row contains the focal node, its neighbour and the Queen contiguity weight.