eodal.mapper.feature module

Module defining geographic features for mapping.

New in version 0.1.1.

Copyright (C) 2022 Lukas Valentin Graf

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

class eodal.mapper.feature.Feature(name: str, geometry: MultiPoint | MultiPolygon | Point | Polygon, epsg: int, attributes: Dict[str, Any] | Series | None = {})[source]

Bases: object

Generic class for a geographic feature

Attrib name:

name of the feature (used for identification)

Attrib geometry:

shapely geometry of the feature in a spatial reference system

Attrib epgs:

spatial coordinate reference system of the feature as EPSG code

Attrib attributes:

optional attributes of the feature

__init__(name: str, geometry: MultiPoint | MultiPolygon | Point | Polygon, epsg: int, attributes: Dict[str, Any] | Series | None = {})[source]

Class constructor

Parameters:
  • name – name of the feature (used for identification)

  • geometryshapely geometry of the feature in a spatial reference system

  • epgs – spatial coordinate reference system of the feature as EPSG code

  • attributes – optional attributes of the feature

property attributes: Dict

feature attributes

property epsg: int

the feature coordinate reference system as EPSG code

classmethod from_dict(dictionary: Dict[str, Any])[source]

Feature object from Python dictionary

Parameters:

dictionary – Python dictionary object to cast to Feature

Returns:

Feature instance created from input dictionary

classmethod from_geoseries(gds: GeoSeries)[source]

Feature object from GeoSeries

Parameters:

gdsGeoSeries to cast to Feature

Returns:

Feature instance created from input GeoSeries

property geometry: MultiPoint | MultiPolygon | Point | Polygon

the feature geometry

property name: str

the feature name

to_dict() Dict[str, Any][source]

Casts feature to a pure Python dictionary

Returns:

Feature object as pure Python dictionary

to_epsg(epsg: int)[source]

Projects the feature into a different spatial reference system identified by an EPSG code. Returns a copy of the Feature with transformed coordinates.

Parameters:

epsg – EPSG code of the reference system the feature is project to

Returns:

new Feature instance in the target spatial reference system

to_geoseries() GeoSeries[source]

Casts the feature to a GeoSeries object

Returns:

Feature object casted as GeoSeries