Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/esri.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def _sub_query(self, params):
else:
self.exceededTransferLimit = False
# Read the response into a GeoDataFrame
sub_gdf = gpd.read_file(self.response.text)
sub_gdf = gpd.read_file(self.response.text, engine='fiona')
return sub_gdf

def _api_call(self, url, params=None):
Expand Down
19 changes: 14 additions & 5 deletions data/nld/levee_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,16 @@ def download_nld_lines():

# Query REST service to download levee 'system routes'
print("Downloading levee lines from the NLD...")
nld_url = "https://ags03.sec.usace.army.mil/server/rest/services/NLD2_PUBLIC/FeatureServer/15/query"
nld_url = "https://geospatial.sec.usace.army.mil/dls/rest/services/NLD/Public/FeatureServer/15/query"
levees = ESRI_REST.query(
nld_url, f="json", where="1=1", returnGeometry="true", outFields="*", outSR=epsg_code, returnZ="true"
nld_url,
f="json",
where="1=1",
returnGeometry="true",
outFields="*",
outSR=epsg_code,
returnZ="true",
resultRecordCount=5000,
)

# Write levees to a single geopackage
Expand Down Expand Up @@ -72,11 +79,13 @@ def process_levee_lines(levee_gdf: gpd.GeoDataFrame, out_levees: str):

# Filter vertices that have z-values less than the minimum from levee geometry
tqdm.pandas(desc='Removing null elevations')
if 'MultiLineString' in levee_gdf.geom_type.unique():
levee_gdf = levee_gdf.explode()
levee_gdf['geometry'] = levee_gdf.progress_apply(lambda row: remove_nulls(row.geometry, row.HUC2), axis=1)
# Remove levees that have empty geometries resulting from the previous filter
levee_gdf = levee_gdf[~levee_gdf.is_empty]
levee_gdf.to_file(out_levees, index=False, driver='GPKG', engine='fiona')
print(f"Preprocessed levees written to \n{out_levees}")
print(f"Preprocessed levees written to \n{out_levees}\n")


def remove_nulls(geom: LineString, huc: str):
Expand Down Expand Up @@ -144,7 +153,7 @@ def download_nld_poly():
'''
# Query REST service to download levee 'system routes'
print("Downloading levee protected areas from the NLD...")
nld_area_url = "https://ags03.sec.usace.army.mil/server/rest/services/NLD2_PUBLIC/FeatureServer/14/query"
nld_area_url = "https://geospatial.sec.usace.army.mil/dls/rest/services/NLD/Public/FeatureServer/17/query"
# FYI to whomever takes the time to read this code, the resultRecordCount had to be set on this query
# because the service was returning an error that turned out to be caused by the size of the request.
# Running the default max record count of 5000 was too large for polygons, so using resultRecordCount=2000
Expand All @@ -156,7 +165,7 @@ def download_nld_poly():
returnGeometry="true",
outFields="*",
outSR=epsg_code,
resultRecordCount=2000,
resultRecordCount=1000,
)

# Write levees to a single geopackage
Expand Down
12 changes: 12 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
All notable changes to this project will be documented in this file.
We follow the [Semantic Versioning 2.0.0](http://semver.org/) format.

## v4.8.x.x - 2025-09-19 - [PR#1655](https://github.com/NOAA-OWP/inundation-mapping/pull/1655)

Updates the National Levee Database (NLD) feature server URL. A new set of data were downloaded and the bash_variables file was updated with the new acquisition date.

### Changes
- `data/`
- `esri.py`: Use `fiona` to read file
- `nld/levee_download.py`: Update FeatureServer URL and handle MultiLineString data
- `src/bash_variables.env`: Update path to levee data with new date

<br/>

## v4.8.10.3 - 2025-08-29 - [PR#1627](https://github.com/NOAA-OWP/inundation-mapping/pull/1627)

Adds gcsfs dependency to allow retrieval of NWM output from the Google Cloud Service.
Expand Down
14 changes: 7 additions & 7 deletions src/bash_variables.env
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export ALASKA_CRS=EPSG:3338

# NOTE: $inputsDir is defined in Dockerfile

export pre_clip_huc_dir=${inputsDir}/pre_clip_huc8/20250717/
export pre_clip_huc_dir=${inputsDir}/pre_clip_huc8/20250917/

export input_DEM=${inputsDir}/dems/3dep_dems/10m_5070/20250616/hand_seamless_3dep_dems.vrt
export input_DEM_domain=${inputsDir}/dems/3dep_dems/10m_5070/20250616/DEM_Domain.gpkg
Expand All @@ -28,12 +28,12 @@ export input_WBD_gdb_Alaska=${inputsDir}/wbd/WBD_National_Sout
export input_landsea=${inputsDir}/landsea/water_polygons_us.gpkg
export input_landsea_Alaska=${inputsDir}/landsea/water_polygons_alaska.gpkg
export input_GL_boundaries=${inputsDir}/landsea/gl_water_polygons.gpkg
export input_NLD=${inputsDir}/nld_vectors/System_Routes_NLDFS_5070_230314.gpkg
export input_NLD_Alaska=${inputsDir}/nld_vectors/System_Routes_NLDFS_3338_230314.gpkg
export input_levees_preprocessed=${inputsDir}/nld_vectors/3d_nld_preprocessed_230314.gpkg
export input_levees_preprocessed_Alaska=${inputsDir}/nld_vectors/3d_nld_preprocessed_230314_3338.gpkg
export input_nld_levee_protected_areas=${inputsDir}/nld_vectors/Leveed_Areas_NLDFS_5070_230314.gpkg
export input_nld_levee_protected_areas_Alaska=${inputsDir}/nld_vectors/Leveed_Areas_NLDFS_3338_230314.gpkg
export input_NLD=${inputsDir}/nld_vectors/System_Routes_NLDFS_5070_250910.gpkg
export input_NLD_Alaska=${inputsDir}/nld_vectors/System_Routes_NLDFS_3338_250910.gpkg
export input_levees_preprocessed=${inputsDir}/nld_vectors/3d_nld_preprocessed_250910.gpkg
export input_levees_preprocessed_Alaska=${inputsDir}/nld_vectors/3d_nld_preprocessed_250910_3338.gpkg
export input_nld_levee_protected_areas=${inputsDir}/nld_vectors/Leveed_Areas_NLDFS_5070_250910.gpkg
export input_nld_levee_protected_areas_Alaska=${inputsDir}/nld_vectors/Leveed_Areas_NLDFS_3338_250910.gpkg
export input_nwm_catchments=${inputsDir}/nwm_hydrofabric/nwm_catchments.gpkg
export input_nwm_catchments_Alaska=${inputsDir}/nwm_hydrofabric/nwm_catchments_alaska.gpkg
export input_nwm_flows=${inputsDir}/nwm_hydrofabric/nwm_flows_20250328.gpkg
Expand Down