Hi everyone,
I am trying to change my script to loop through the State_Boundary layer and do the below geoprocessing tool for all states in Australia. the results should be hydrology layer for each states which clipped based on properties layer. How can I change this to create only *_Hydrology layer and delete rest of layers? At the moment I need to change the name of states, inputs and outputs!
Hydrology=r"V:\Hydro\Data\NSW_HYDRO_LINE_shp.shp" All hydrology layers saved in one folder but divided by states.
Thanks
#1. Import system modules
import arcpy
arcpy.env.overwriteOutput= True
#2. set environmnet setting
arcpy.env.workspace =r"R:\R\Data\Buffer_States.gdb"
#3. Seprate a state from State_Boundary layer
FC_Properties=r"R:\R\Data\Properties.shp"
FC_BoundaryState=r"R:\R\Data\State_Boundary.shp"
FC_State=r"R:\R\Data\Buffer_States.gdb\NewSouthWales"
Hydrology=r"V:\Hydro\Data\NSW_HYDRO_LINE_shp.shp"
StateName="NEW SOUTH WALES"
arcpy.analysis.Select(FC_BoundaryState,FC_State, "NAM = '{0}'".format(StateName))
#4.Clip the properties layer based on a state
arcpy.analysis.Clip(FC_Forest, FC_State, "NSW_Properties", None)
#5.Buffer properties layer
DistanceField="20 Meter"
arcpy.analysis.Buffer("NSW_Properties", "NSWProperties_Buffer", DistanceField, "FULL", "ROUND", "NONE", None, "PLANAR")
#6. Clip Hydrology layer based on properties
arcpy.analysis.Clip(Hydrology,"NSWProperties_Buffer", "NewSouthWales_Hydrology", None)