Profile extraction using ArcPy
Institute for Environmental and Spatial Analysis...University of North Georgia
1 Data set
In this lecture, we will perform various spatial analyses using ArcPy.
Add all the layers in the nc_spm_08_grass7_exercise data set.
2 Extract the profile of a selected stream
- Get the
Rasterobject of the elevation.tif layer
- Get the NumPy array of the elevation.tif layer
- Get the selected stream polyline
- Densify the stream line using half the mean elevation cell width
- Loop through vertices in the densified stream line
- For each vertex
- Convert x and y to row and column
- Read the elevation.tif cell value at row and column
from mpl_toolkits.mplot3d import Axes3D fig = plt.figure() ax = fig.gca(projection='3d') ax.plot(x, y, z) plt.show() x, y = np.meshgrid(range(elev_a.shape), range(elev_a.shape)) fig = plt.figure() ax = fig.gca(projection='3d') ax.plot_surface(x, y, elev_a) plt.show()