GeezerVison is showing developers.arcgis.com — arcgis.features.hydrology module | ArcGIS API for Python | Esri Developer
These functions help you use hydrology analysis.
trace_downstream
-
arcgis.features.hydrology.trace_downstream(input_points, point_id_field: str | None = None, source_database: str = 'Finest', generalize: bool = False, gis: GIS | None = None, future: bool = False)
The trace_downstream method delineates the downstream path from a specified location.
Esri-curated elevation data is used to create an output polyline delineating the flow path
downstream from the specified input location. This method accesses a service using multiple
source databases which are available for different geographic areas and at different
spatial scales.
Parameter |
Description |
input_points |
Required FeatureSet or Spatially Enabled DataFrame
Points delineating the starting location to calculate the downstream
location from. See Feature Input. |
point_id_field |
Optional string. Field used to identify the feature from the source data. This is
useful for relating the results back to the original source data. |
source_database |
Optional string. Keyword indicating the source data that will be used in the
analysis. This keyword is an approximation of the spatial resolution
of the digital elevation model used to build the foundation
hydrologic database. Since many elevation sources are distributed
with units of arc seconds, this keyword is an approximation in
meters for easier understanding.
Finest: Finest resolution available at each location from all
possible data sources.
10m: The hydrologic source was built from 1/3 arc second -
approximately 10 meter resolution, elevation data.
30m: The hydrologic source was built from 1 arc second -
approximately 30 meter resolution, elevation data.
90m: The hydrologic source was built from 3 arc second -
approximately 90 meter resolution, elevation data.
The default value is ‘Finest’.
|
generalize |
Optional boolean. Determines if the output downstream trace lines will be smoothed
into simpler lines.
The default value is False.
|
gis |
Optional GIS Object instance. If not provided as input, a GIS object instance logged into an
active portal with elevation helper services defined must already
be created in the active Python session. A GIS object instance can
also be optionally explicitly passed in through this parameter. |
future |
Optional boolean. If True, a future object will be returned and the process
will not wait for the task to complete. The default is False, which means wait for results. |
- Returns:
A new FeatureSet
# USAGE EXAMPLE: To trace downstream path from from the outlet points.
from arcgis.gis import GIS
from arcgis.features.analysis import trace_downstream
gis = GIS("home")
input_points_item = gis.content.get("<input_points_item_id>")
input_points_layer = input_points_item.layers[0]
fs = input_points_layer.query(where="1=1", as_df=False)
path = trace_downstream(input_points=fs,
source_database='Finest',
generalize=False)
watershed
-
arcgis.features.hydrology.watershed(input_points, point_id_field: str | None = None, snap_distance: float = 10, snap_distance_units: str = 'Meters', source_database: str = 'Finest', generalize: bool = False, gis: GIS | None = None, return_snapped_points: bool = True, future: bool = False)
The watershed is used to identify catchment areas based on a particular location you
provide and ArcGIS Online Elevation data.
Parameter |
Description |
input_points |
Required FeatureSet or Spatially Enabled DataFrame. Points delineating the starting location to calculate the downstream
location from. See Feature Input. |
point_id_field |
Optional String. Field used to identify the feature from the source data. This is
useful for relating the results back to the original source data. |
snap_distance |
Optional float. The maximum distance to move the location of an input point.
Interactive input points and documented gage locations may not exactly align with the stream location in the DEM.
This parameter allows the task to move the point to a nearby location with the largest contributing area.
The snap distance should always be larger than the source data resolution. By default, the snapping distance
is calculated as the resolution of the source data multiplied by 5.
The default value is 10.
|
snap_distance_units |
Optional String. The linear units specified for the snap distance.
Choice list: [‘Meters’, ‘Kilometers’, ‘Feet’, ‘Yards’, ‘Miles’].
The default value is ‘Meters’.
|
source_database |
Optional String. Keyword indicating the source data that will be used in the analysis.
This keyword is an approximation of the spatial resolution of the
digital elevation model used to build the foundation hydrologic
database. Since many elevation sources are distributed with units of
arc seconds, this keyword is an approximation in meters for easier
understanding.
Finest: Finest resolution available at each location from all possible data sources.
10m: The hydrologic source was built from 1/3 arc second - approximately 10 meter resolution, elevation data.
30m: The hydrologic source was built from 1 arc second - approximately 30 meter resolution, elevation data.
90m: The hydrologic source was built from 3 arc second - approximately 90 meter resolution, elevation data.
The default value is ‘Finest’.
|
generalize |
Optional boolean. Determines if the output downstream trace lines will be smoothed
into simpler lines.
The default value is False.
|
gis |
Optional GIS Object instance. If not provided as input, a GIS object instance logged into an
active portal with elevation helper services defined must already
be created in the active Python session. A GIS object instance can
also be optionally explicitly passed in through this parameter. |
return_snapped_points |
Optional boolean. Determines if a point feature at the watershed’s pour point will be returned.
If snapping is enabled, this might not be the same as the input point.
The default value is True.
|
future |
Optional boolean. If True, a future object will be returned and the process
will not wait for the task to complete. The default is False, which means wait for results. |
- Returns:
Result object comprised of two FeatureSets - one for watershed_area, and another for snapped_points
# USAGE EXAMPLE: To identify catchment areas around Chennai lakes.
from arcgis.gis import GIS
from arcgis.features.analysis import watershed
gis = GIS("home")
lakes_item = gis.content.get("<input_points_item_id>")
lakes_layer = lakes_item.layers[0]
lakes_fs = lakes_layer.query(where="1=1", as_df=False)
lakes_watershed = watershed(input_points=lakes_fs,
snap_distance=10,
snap_distance_units='Meters',
source_database='Finest',
generalize=False)
|