Skip to content

Commit 49886ef

Browse files
author
Stevenray Janke
committed
Bugfix
1 parent 207741e commit 49886ef

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

hecstac/hms/item.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,9 @@ def from_prj(cls, hms_project_file, item_id: str, simplify_geometry: bool = True
6969
pm = LocalPathManager(Path(hms_project_file).parent)
7070
href = pm.item_path(item_id)
7171
pf = ProjectFile(hms_project_file, assert_uniform_version=False)
72-
7372
# Create GeoJSON and Thumbnails
7473
cls._check_files_exists(cls, pf.files + pf.rasters)
75-
geojson_paths = cls.write_element_geojsons(cls, pf.basins, pm)
74+
geojson_paths = cls.write_element_geojsons(cls, pf.basins, pm, pf)
7675
thumbnail_paths = cls.make_thumbnails(cls, pf.basins, pm)
7776

7877
# Collect all assets
@@ -201,7 +200,7 @@ def make_thumbnails(self, basins: list[BasinFile], pm: LocalPathManager, overwri
201200

202201
return thumbnail_paths
203202

204-
def write_element_geojsons(self, basins: list[BasinFile], pm: LocalPathManager, overwrite: bool = False):
203+
def write_element_geojsons(self, basins: list[BasinFile], pm: LocalPathManager, pf, overwrite: bool = False):
205204
"""Write the HMS elements (Subbasins, Juctions, Reaches, etc.) to geojson."""
206205
geojson_paths = []
207206
for element_type in basins[0].elements.element_types:
@@ -211,7 +210,7 @@ def write_element_geojsons(self, basins: list[BasinFile], pm: LocalPathManager,
211210
logger.info(f"Geojson for {element_type} already exists. Skipping creation.")
212211
else:
213212
logger.info(f"Creating geojson for {element_type}")
214-
gdf = self.pf.basins[0].feature_2_gdf(element_type).to_crs(4326)
213+
gdf = pf.basins[0].feature_2_gdf(element_type).to_crs(4326)
215214
logger.debug(gdf.columns)
216215
keep_columns = ["name", "geometry", "Last Modified Date", "Last Modified Time", "Number Subreaches"]
217216
gdf = gdf[[col for col in keep_columns if col in gdf.columns]]

0 commit comments

Comments
 (0)