@@ -69,10 +69,9 @@ def from_prj(cls, hms_project_file, item_id: str, simplify_geometry: bool = True
69
69
pm = LocalPathManager (Path (hms_project_file ).parent )
70
70
href = pm .item_path (item_id )
71
71
pf = ProjectFile (hms_project_file , assert_uniform_version = False )
72
-
73
72
# Create GeoJSON and Thumbnails
74
73
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 )
76
75
thumbnail_paths = cls .make_thumbnails (cls , pf .basins , pm )
77
76
78
77
# Collect all assets
@@ -201,7 +200,7 @@ def make_thumbnails(self, basins: list[BasinFile], pm: LocalPathManager, overwri
201
200
202
201
return thumbnail_paths
203
202
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 ):
205
204
"""Write the HMS elements (Subbasins, Juctions, Reaches, etc.) to geojson."""
206
205
geojson_paths = []
207
206
for element_type in basins [0 ].elements .element_types :
@@ -211,7 +210,7 @@ def write_element_geojsons(self, basins: list[BasinFile], pm: LocalPathManager,
211
210
logger .info (f"Geojson for { element_type } already exists. Skipping creation." )
212
211
else :
213
212
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 )
215
214
logger .debug (gdf .columns )
216
215
keep_columns = ["name" , "geometry" , "Last Modified Date" , "Last Modified Time" , "Number Subreaches" ]
217
216
gdf = gdf [[col for col in keep_columns if col in gdf .columns ]]
0 commit comments