<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Create hydrology layers for each state with arcpy in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/create-hydrology-layers-for-each-state-with-arcpy/m-p/1091642#M62165</link>
    <description>&lt;P&gt;Are you familiar with &lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/analysis/geoprocessing/modelbuilder/what-is-modelbuilder-.htm" target="_self"&gt;modelbuilder&lt;/A&gt;, this would be &lt;EM&gt;very simple&lt;/EM&gt; to do in that? You would use a feature iterator to step over each state in your boundary layer and that becomes the buffered clipper geometry? Not a single line of python code needs to be written to solve this task.&lt;/P&gt;&lt;P&gt;If you want to continue in the scripting environment then you need to read the help file on &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/data-access/searchcursor-class.htm" target="_self"&gt;SearchCursors&lt;/A&gt; as that is what you need to use to extract the state names and create a simple loop. If your coding skills are not up to that then I would recommend modelbuilder for developing repetitive automation with little or no coding required.&lt;/P&gt;</description>
    <pubDate>Tue, 24 Aug 2021 10:23:13 GMT</pubDate>
    <dc:creator>DuncanHornby</dc:creator>
    <dc:date>2021-08-24T10:23:13Z</dc:date>
    <item>
      <title>Create hydrology layers for each state with arcpy</title>
      <link>https://community.esri.com/t5/python-questions/create-hydrology-layers-for-each-state-with-arcpy/m-p/1091607#M62164</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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&amp;nbsp; layer and delete rest of layers? At the moment I need to change the name of states, inputs and outputs!&lt;/P&gt;&lt;P&gt;Hydrology=r"V:\Hydro\Data\NSW_HYDRO_LINE_shp.shp"&amp;nbsp; All hydrology layers saved in one folder but divided by states.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;LI-CODE lang="python"&gt;#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)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 07:10:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/create-hydrology-layers-for-each-state-with-arcpy/m-p/1091607#M62164</guid>
      <dc:creator>MaryamPanji</dc:creator>
      <dc:date>2021-08-24T07:10:57Z</dc:date>
    </item>
    <item>
      <title>Re: Create hydrology layers for each state with arcpy</title>
      <link>https://community.esri.com/t5/python-questions/create-hydrology-layers-for-each-state-with-arcpy/m-p/1091642#M62165</link>
      <description>&lt;P&gt;Are you familiar with &lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/analysis/geoprocessing/modelbuilder/what-is-modelbuilder-.htm" target="_self"&gt;modelbuilder&lt;/A&gt;, this would be &lt;EM&gt;very simple&lt;/EM&gt; to do in that? You would use a feature iterator to step over each state in your boundary layer and that becomes the buffered clipper geometry? Not a single line of python code needs to be written to solve this task.&lt;/P&gt;&lt;P&gt;If you want to continue in the scripting environment then you need to read the help file on &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/data-access/searchcursor-class.htm" target="_self"&gt;SearchCursors&lt;/A&gt; as that is what you need to use to extract the state names and create a simple loop. If your coding skills are not up to that then I would recommend modelbuilder for developing repetitive automation with little or no coding required.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 10:23:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/create-hydrology-layers-for-each-state-with-arcpy/m-p/1091642#M62165</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2021-08-24T10:23:13Z</dc:date>
    </item>
  </channel>
</rss>

