environmentaltools.spatial.spatial_mask

environmentaltools.spatial.spatial_mask(data, polygon, op='within')[source]

Apply spatial mask to data points based on polygon geometry.

Filters data points based on their spatial relationship with a polygon (within or outside the polygon boundary).

Parameters:
  • data (pd.DataFrame) – Point data with columns [‘x’, ‘y’, …other columns]

  • polygon (gpd.GeoDataFrame) – Polygon geometry for masking

  • op (str, optional) – Operation type: ‘within’ (inside polygon) or other (outside polygon). Default: ‘within’

Returns:

Filtered data containing only points satisfying the spatial condition

Return type:

pd.DataFrame