0

I would like to create a dynamic buffer based on contributing drainage area for a stream. I have done some research and I think the best way would be to use the flow accumulation tool but I'm not sure how to isolate just the stream bed pixels of the flow accumulation raster.

I eventually want to create a buffer based on the acreage of the contributing drainage area for the stream so the buffer would get bigger by pre-defined intervals as the drainage area reached certain values.

1 Answer 1

2

Input:

enter image description here

Workflow:

#convert flow accumulation to streams raster
arcpy.gp.RasterCalculator_sa("""Con("facc" >= 100000,1)""", "D:/Scratch/stream_r")
#derive streams as polylines
arcpy.gp.StreamToFeature_sa("stream_r", "fdir", "D:/Scratch/streams.shp", "SIMPLIFY")
#get streams vertices
arcpy.FeatureVerticesToPoints_management(in_features="streams", out_feature_class="D:/Scratch/points.shp", point_location="ALL")
arcpy.DeleteIdentical_management(in_dataset="points", fields="Shape", xy_tolerance="", z_tolerance="0")
#create good unique id for points
arcpy.AddField_management(in_table="points", field_name="PointID", field_type="TEXT", field_precision="", field_scale="", field_length="10")
arcpy.CalculateField_management(in_table="points", field="PointID", expression="'P%s'%str( !FID!).zfill(4)", expression_type="PYTHON_9.3", code_block="")
#create small buffer (0.5*cell size) around points
arcpy.Buffer_analysis(in_features="points", out_feature_class="D:/Scratch/buffers.shp", buffer_distance_or_field="1 Meters", line_side="FULL", line_end_type="ROUND", dissolve_option="NONE", dissolve_field="", method="PLANAR")
#and get flow accumulation at point
arcpy.gp.ZonalStatisticsAsTable_sa("buffers", "PointID", "facc", "D:/Scratch/stats.dbf", "DATA", "MAXIMUM")
# TRANSFER Max flow accumulation from statistics table to buffers’ table into field FACC through point ID join
arcpy.AddField_management(in_table="buffers", field_name="FACC", field_type="LONG")
# get directional vectors near points
arcpy.Intersect_analysis(in_features="buffers #;streams #", out_feature_class="D:/Scratch/sections.shp", join_attributes="ALL")
# and scale very large values of flow accumulation into practical buffer sizes
arcpy.CalculateField_management(in_table="sections", field="Extend", expression="[FACC]*0.0000286102783177759+2.12240681707642")

Use solution from: Create a line perpendicular to an existing line in ArcGIS to convert Sections into varying size perpendiculars

Use solution from:

How to create a polygon connecting the endpoints of multiple lines using python?

to get this:

enter image description here

As one can see some manual editing will be required

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.