pyforestry.sweden.geo package#

Subpackages#

Submodules#

pyforestry.sweden.geo.geo module#

Simple geographic utilities using Swedish shapefiles.

class pyforestry.sweden.geo.geo.RetrieveGeoCode[source]#

Bases: object

Helper methods for querying Swedish geographic data.

static getClimateCode(lon, lat, epsg=4326) → SwedenClimateZone | None[source]#

Backward-compatible alias for get_climate_code().

static getCountyCode(lon, lat, epsg=4326) → SwedenCounty | None[source]#

Backward-compatible alias for get_county_code().

static getDistanceToCoast(lon, lat, epsg=4326)[source]#

Backward-compatible alias for get_distance_to_coast_km().

static get_climate_code(longitude: float, latitude: float, epsg: int = 4326) → SwedenClimateZone | None[source]#

Retrieve the climate zone enum member for a given coordinate.

Parameters:
  • longitude (float) – Longitude (in the input CRS).

  • latitude (float) – Latitude (in the input CRS).

  • epsg (int) – EPSG code for the input coordinates (default: 4326).

Returns:

The climate zone enum member or None if not found.

Return type:

Sweden.ClimateZone | None

static get_county_code(longitude: float, latitude: float, epsg: int = 4326) → SwedenCounty | None[source]#

Retrieve the county enum member for a given coordinate.

Parameters:
  • longitude (float) – Longitude (in the input CRS).

  • latitude (float) – Latitude (in the input CRS).

  • epsg (int) – EPSG code for the input coordinates (default: 4326).

Returns:

The corresponding SwedenCounty enum member or None if not found.

Return type:

SwedenCounty | None

static get_distance_to_coast_km(longitude: float, latitude: float, epsg: int = 4326) → float[source]#

Calculate the distance from a given point (lon/lat in the input CRS) to the nearest coastline point. Internally, the calculation is done in the metric projection EPSG:3857.

Parameters:
  • longitude (float) – Longitude (in the input CRS).

  • latitude (float) – Latitude (in the input CRS).

  • epsg (int) – EPSG code for the input coordinates (default: 4326).

Returns:

Distance in kilometers to the nearest coastline.

Return type:

float

Module contents#

Convenience re-exports for geospatial utilities.