Skip to content

Commit 69d1ff3

Browse files
committed
refactor: renamed collection_extents_crs to dst_crs
1 parent 90c52f7 commit 69d1ff3

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

swisstopopy/stac.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,16 +168,27 @@ def gdf_from_collection(
168168
collection_id: str,
169169
*,
170170
datetime: DatetimeLike | None = None,
171-
collection_extents_crs: CRSType | None = None,
171+
dst_crs: CRSType | None = None,
172172
) -> gpd.GeoDataFrame:
173-
"""Get geo-data frame of tiles of a collection."""
174-
if collection_extents_crs is None:
175-
collection_extents_crs = self._client.get_collection(
176-
collection_id
177-
).extra_fields["crs"][0]
173+
"""Get geo-data frame of tiles of a collection.
174+
175+
Parameters
176+
----------
177+
collection_id : str
178+
Collection ID to get the data for.
179+
datetime : datetime-like, optional
180+
Datetime-like object forwarded to `pystac_client.Client.search` to filter
181+
the items. If None, all the items of the collection will be returned.
182+
dst_crs : crs-like, optional
183+
Coordinate reference system (CRS) of the returned geo-data frame. If None,
184+
the CRS of the collection tiles will be used - note that this is not
185+
(necessarily) the same as the CRS of the tile data itself.
186+
"""
187+
if dst_crs is None:
188+
dst_crs = self._client.get_collection(collection_id).extra_fields["crs"][0]
178189
search = self._client.search(
179190
collections=[collection_id], intersects=self.region, datetime=datetime
180191
)
181192
return gpd.GeoDataFrame(
182193
_postprocess_items_gdf(_items_to_gdf(search.items_as_dicts()))
183-
).set_crs(collection_extents_crs)
194+
).set_crs(dst_crs)

0 commit comments

Comments
 (0)