gpf_entrepot_toolbelt.orchestrator.models.extent module¶
- class gpf_entrepot_toolbelt.orchestrator.models.extent.GpfExtent(extent: tuple[float] | None = None)¶
Bases :
object
GPF Extent class.
Exemple
extent = GpfExtent([2.1,-1.3,46.2,22.0])
- __init__(extent: tuple[float] | None = None)¶
Object initialization.
- Paramètres:
extent (Optionnal Tuple[float]) – étendue géographique sous forme de Tuple(float) (East, West, North, South)
- add_extent(extent: Self)¶
Ajoute l’extent en parametre à l’extent actuelle
- Paramètres:
extent (GpfExtent) – extent a ajouter
- classmethod from_dict(val: dict) Self ¶
Load object from a dict.
- Paramètres:
val (dict) – dict value to load
- Renvoie:
object with attributes filled from dict.
- Type renvoyé:
Self
Exemple
extent = GpfExtent.from_dict({ "geometry": { "type": "Polygon", "coordinates": [ [ [2.1, 22.0], [2.1, 46.2], [-1.3, 46.2], [-1.3, 22.0], [2.1, 22.0] ] ] } }) print(extent.east)
- property geom: BaseGeometry | None¶
Return geom in shapely format
- Renvoie:
geom
- Type renvoyé:
object
- is_old_format_extent(extent: tuple[float]) bool ¶
Vérifie si l’extent en parametre est valide
- Paramètres:
extent (Tuple[float]) – étendue géographique sous forme de Tuple(float) (East, West, North, South)
- Renvoie:
True si l’extent est valide selon l’ancien format False sinon
- Type renvoyé:
bool
- is_valid() bool ¶
Check si l’extent est valid
- Renvoie:
True si l’extent est valid False sinon
- Type renvoyé:
bool
- simplify(max_nb_points: int = 5000, max_iterations: int = 100, buffer=0.0006)¶
Simplify extent geometry
- Paramètres:
max_nb_points – target maximum points number for simplification
max_iterations – maximum number of iteration
buffer – buffer distance, defaults 0.0006 degrees ~ 50 meters
- to_dict() dict ¶
Convert dataclass object into dictionary. Supersedes dataclass.asdict.
- Renvoie:
object as dictionary
- Type renvoyé:
dict
Exemple
extent = GpfExtent([2.1,-1.3,46.2,22.0]) print(extent.to_dict())
- to_list() list ¶
retourne l’extent sous form de list
- Renvoie:
extent sous forme de liste (coordinates)
- Type renvoyé:
list