mappymatch.constructs.geofence#

Classes

Geofence(crs, geometry)

A geofence is basically a shapely polygon with a CRS

class mappymatch.constructs.geofence.Geofence(crs, geometry)[source]#

A geofence is basically a shapely polygon with a CRS

Args:

geom: The polygon geometry of the geofence crs: The CRS of the geofence

Parameters:
  • crs (CRS)

  • geometry (Polygon)

classmethod from_geojson(file)[source]#

Creates a new geofence from a geojson file.

Return type:

Geofence

Parameters:

file (Path | str)

Args:

file: The path to the geojson file

Returns:

A new geofence

classmethod from_trace(trace, padding=1000.0, crs=<Geographic 2D CRS: EPSG:4326> Name: WGS 84 Axis Info [ellipsoidal]: - Lat[north]: Geodetic latitude (degree) - Lon[east]: Geodetic longitude (degree) Area of Use: - name: World. - bounds: (-180.0, -90.0, 180.0, 90.0) Datum: World Geodetic System 1984 ensemble - Ellipsoid: WGS 84 - Prime Meridian: Greenwich, buffer_res=2)[source]#

Create a new geofence from a trace.

This is done by computing a radial buffer around the entire trace (as a line).

Return type:

Geofence

Parameters:
  • trace (Trace)

  • padding (float)

  • crs (CRS)

  • buffer_res (int)

Args:

trace: The trace to compute the bounding polygon for. padding: The padding (in meters) around the trace line. crs: The coordinate reference system to use. buffer_res: The resolution of the surrounding buffer.

Returns:

The computed bounding polygon.

to_geojson()[source]#

Converts the geofence to a geojson string.

Return type:

str