Skip to content

Commit

Permalink
#if isinstance(asset_locations, str):
Browse files Browse the repository at this point in the history
  • Loading branch information
Santonia27 committed Nov 20, 2024
1 parent a5b9eb6 commit 81c790e
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions hydromt_fiat/workflows/exposure_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 81c790e

Please sign in to comment.