AnsweredAssumed Answered

How do you create point shapefiles on a raster to create watersheds?

Question asked by apmartincude on Aug 1, 2017
Latest reply on Aug 1, 2017 by apmartincude

Hey I am trying to automate the process to add watersheds at the most accumulated points at the bottom of the dem layer. I created a stream order to provide as a template to place the points and a flow direction to create the watershed. The stream order has 9111 columns and 6941 rows. I am creating a point  shapefile at every value (1,2,3) at the last row of the matrix. The main problem I have is saving multiple points and given them each a unique name and saving watersheds and giving them a unique name each time it goes through a loop. I am pretty novice at python. I need help with the last part of the code. I keep getting a syntax error on the last line.



import arcpy
from import *
from arcpy import env

  for columns in range(0,9111):
    point=arcpy.Point(demorder.xmin + columns, dem_order.ymin+6941)
    pointval= arcpy.GetCellValue_management("dem_order","point", "2")
    if (pointval==1 or pointval==2 or pointval==3):
        pointgeom = arcpy.pointgeometry(point,"W:\ArcMap\Coordinate_Systems\NAD 1983 StatePlane Texas S Central FIPS 4204 (US Feet) SURFACE.prj")
        Pshape= arcpy.CopyFeatures_management(pointgeom,"C:\Temp\ARCGIS_PROJECT\Tutorial\points")
        watershed= arcpy.watershed(flowdirection,Pshape)