-
Notifications
You must be signed in to change notification settings - Fork 0
/
StreamLineFromLidar
56 lines (44 loc) · 1.86 KB
/
StreamLineFromLidar
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# This script is designed to be used within ArcPro's ArcPy module to create a script tool capable of automating stream polyline digitization from an LAS Dataset
import arcpy
# Set WorkspaceEnvironment
arcpy.env.workspace = arcpy.GetParameterAsText(0)
inLasD = arcpy.GetParameterAsText(1)
# LAS Dataset to DEM, extract LAS Ground
LASLyr1 = arcpy.CreateUniqueName(inLasD + 'Grnd')
arcpy.MakeLasDatasetLayer_management(inLasD,LASLyr1,"2")
# LAS Ground to Raster
DEMName = arcpy.GetParameterAsText(2)
arcpy.LasDatasetToRaster_conversion(LASLyr1, DEMName, "ELEVATION", "BINNING IDW NATURAL_NEIGHBOR", "FLOAT", "CELLSIZE", 3, 1)
# Fill DEM Raster
FillZ = arcpy.GetParameterAsText(3)
FillDem = arcpy.sa.Fill(DEMName, FillZ)
OutFill = arcpy.GetParameterAsText(0) + "\out_fill"
FillDem.save(OutFill)
# Flow Direction
FlowDir = arcpy.sa.FlowDirection("out_fill", "", "")
OutFlow = arcpy.GetParameterAsText(0) + "\out_flow"
FlowDir.save(OutFlow)
# Flow Accumulation
FlowAcc = arcpy.sa.FlowAccumulation("out_flow", "", "INTEGER", "")
OutFlowAc = arcpy.GetParameterAsText(0) + "\out_acc"
FlowAcc.save(OutFlowAc)
#Con Tool
GreatThan = "VALUE >" + arcpy.GetParameterAsText(4)
outcon = arcpy.sa.Con("out_acc", 1,"", GreatThan)
OutCON = arcpy.GetParameterAsText(0) + "\out_con.tif"
outcon.save(OutCON)
# Stream Links
StreamLnk = arcpy.sa.StreamLink("out_con.tif", "out_flow",)
StreamLink = arcpy.GetParameterAsText(0) + "\stream_link"
StreamLnk.save(StreamLink)
# Watershed tool
WatShed = arcpy.sa.Watershed("out_flow", "stream_link")
OutShed = arcpy.GetParameterAsText(0) + "\WatShed"
WatShed.save(OutShed)
# Raster to Polygon
WatShedName = arcpy.GetParameterAsText(5)
arcpy.RasterToPolygon_conversion("WatShed", WatShedName)
# Stream to Polygon
OPTION = arcpy.GetParameterAsText(6)
StreamName = arcpy.GetParameterAsText(7)
StreamLine = arcpy.sa.StreamToFeature("out_con.tif", "out_Flow", StreamName, OPTION)