Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions pynsee/geodata/get_geodata.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def get_geodata(
update: bool = False,
crs: Any = "EPSG:3857",
constrain_area: Optional[GeoDataFrame] = None,
silent: bool = False,
) -> GeoFrDataFrame:
"""Get geographical data with identifier and from IGN API

Expand All @@ -25,10 +26,17 @@ def get_geodata(

constrain_area (:class:`~geopandas.GeoDataFrame`, optional): GeoDataFrame used to constrain the area of interest. Defaults to None.

silence (bool, optional): whether to print warnings or not. Defaults to False.

.. versionchanged: 0.2.0

Changed `polygon` and `crsPolygon` into a `constrain_area` :class:`~geopandas.GeoDataFrame`.

.. versionchanged: 0.3.0

Added silent parameter.


Examples:
>>> from pynsee.geodata import get_geodata_list, get_geodata
>>> #
Expand All @@ -40,20 +48,21 @@ def get_geodata(

"""
polygon = None
crsPolygon = "EPSG:4326"
crs_polygon = "EPSG:4326"

if constrain_area is not None:
if constrain_area.crs.to_string() not in ("EPSG:3857", "EPSG:4326"):
constrain_area = constrain_area.to_crs("EPSG:4326")

polygon = constrain_area.union_all()
crsPolygon = constrain_area.crs.to_string()
crs_polygon = constrain_area.crs.to_string()

return _get_geodata(
dataset_id=dataset_id,
update=update,
crs=crs,
ignore_error=False,
polygon=polygon,
crs_polygon=crsPolygon,
crs_polygon=crs_polygon,
silent=silent,
)
Loading