geost.accessor.GeostFrame.spatial_join#

GeostFrame.spatial_join(geometries: str | Path | GeoDataFrame, label_id: str | Iterable, drop_label_if_exists: bool = False, **kwargs) GeoDataFrame[source]#

Join information from another GeoDataFrame by a spatial relationship (e.g. overlap) between the geometries in the original GeoDataFrame with the geometries in the other GeoDataFrame.

Parameters:
  • geometries (str | Path | gpd.GeoDataFrame) – Geometries to join with the information from. Can be a GeoDataFrame or a file path to a geospatial file that can be read as a GeoDataFrame.

  • label_id (str | Iterable) – Column name(s) in the geometries GeoDataFrame to join the information from.

  • drop_label_if_exists (bool, optional) – If True, will drop the specified ‘label_id’ from the original GeoDataFrame if these already exist as a column or columns, before the spatial join. Otherwise, suffixes will automatically be added to the joined columns to avoid naming conflicts. The default is False.

  • **kwargs – Keyword arguments to be passed to the GeoPandas geopandas.GeoDataFrame.sjoin() function. See relevant documentation for more information.

Returns:

GeoDataFrame resulting from the spatial join.

Return type:

gpd.GeoDataFrame