From 81c790ed6eff50514ffc7d24b2dbca00fa7c22e8 Mon Sep 17 00:00:00 2001 From: Santonia27 Date: Wed, 20 Nov 2024 14:36:16 +0100 Subject: [PATCH] #if isinstance(asset_locations, str): --- hydromt_fiat/workflows/exposure_vector.py | 30 +++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/hydromt_fiat/workflows/exposure_vector.py b/hydromt_fiat/workflows/exposure_vector.py index 21f2fe75..99f18fb3 100644 --- a/hydromt_fiat/workflows/exposure_vector.py +++ b/hydromt_fiat/workflows/exposure_vector.py @@ -436,24 +436,24 @@ def setup_asset_locations(self, asset_locations: str) -> None: a point or polygon dataset. """ self.logger.info("Setting up asset locations...") - if isinstance(asset_locations, str): - if str(asset_locations).upper() == "OSM": - polygon = self.region.to_crs(4326).geometry.values[0] - assets = get_assets_from_osm(polygon) + #if isinstance(asset_locations, str): + if str(asset_locations).upper() == "OSM": + polygon = self.region.to_crs(4326).geometry.values[0] + assets = get_assets_from_osm(polygon) - if assets.empty: - self.logger.warning( - "No assets found in the selected region from source " - f"{asset_locations}." - ) - - # Rename the osmid column to object_id - assets.rename(columns={"osmid": "object_id"}, inplace=True) - else: - assets = self.data_catalog.get_geodataframe( - asset_locations, geom=self.region + if assets.empty: + self.logger.warning( + "No assets found in the selected region from source " + f"{asset_locations}." ) + # Rename the osmid column to object_id + assets.rename(columns={"osmid": "object_id"}, inplace=True) + else: + assets = self.data_catalog.get_geodataframe( + asset_locations, geom=self.region + ) + # Set the CRS of the exposure data self.crs = get_crs_str_from_gdf(assets.crs)