I have a series of points representing a river network (See Image Above). Each point contains attributes on Latitude, Longitude, Z value and Length calculated using flow accumulation. The river network was created from Digital Elevation Models using hydrology tools in ArcGIS (Fill, Flow Direction, Flow Accumulation, Strahler Order > 4). I also have a polyline shapefile that also runs along this river network.
Starting at the first point at the beginning of each network I would like to determine another point "downstream" that is approximately 2000 metres away (Or closest to 2000 metres). I would then like to calculate channel slope based on the difference in elevation divided by the difference in length (2000m) using the two points.
I am aware that at the junctions there will be an issue, any suggestions on accomplishing this task in GIS to determine the point 2000m downstream and continuing downstream at junctions?
I am using ArcGIS 10.1 with an ArcInfo license and also have access to QGIS and GrassGIS. I am familiar with using python scripts as well.
Edit: Progress
The stream polyline has the following attributes:
x1: x coordinate of start point (Double)
y1: y coordinate of start point (Double)
x2: x coordinate of end point (Double)
y2: y coordinate of end point (Double)
length: length of polyline
shape: shape of polyline
startxy: [x1]&", "&[y1] (Text)
endxy: [x2]&", "&[y2] (Text)
I am using the tool to make arrays
start = arcpy.da.FeatureClassToNumPyArray("polyline",["x1","y1"])
Dictionary
G ={}
>>> for (st,sh,le,en) in zip (start,shape,length,end):
... G[st]=(st,le,en)
Algorithm
def Downstream (p, x, G):
... e = G[p]
... if (IsNull(e)):
... return ("Not Found")
... if (x < 0):
... return ("Invalid")
... if (x < e.length):
... return (Along (e.shape, x))
... return (Downstream (e.end, x-e.length,G))
The Downstream function is receiving a runtime error where there is a key error. I have used G.keys() to see the keys, but they are not working when inputted in the function.
No comments:
Post a Comment