Skip to content
Merged
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
18 changes: 14 additions & 4 deletions pynsee/geodata/get_geodata.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ 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
"""
Get geographical data with identifier and from IGN API

Args:
id (str): data identifier from get_geodata_list function
Expand All @@ -25,10 +27,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.

Comment thread
tgrandje marked this conversation as resolved.
.. 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 +49,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