<?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 Model builder/python - creating a table with data from 2 shapefiles in ModelBuilder Questions</title>
    <link>https://community.esri.com/t5/modelbuilder-questions/model-builder-python-creating-a-table-with-data/m-p/818063#M3339</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to automate a process to select polygons by location based on a different shapefile. This is the model I have built:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="/legacyfs/online/65389_Export Graphic.png"&gt;&lt;IMG alt="Export Graphic.png" class="image-1 jive-image" height="571" src="/legacyfs/online/65389_Export Graphic.png" style="width: 620px; height: 272px;" width="1301" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;This model seems to be running in an infinite loop. What I am trying to do instead is to have it run through each of my 48,000+ data points from "DiatomsPoints" and select the polygon from "huc250kSUBSv2" for each point. Then, I would like the information to be collated into a table which shows the data from "DiatomsPoints" and the corresponding polygon from "huc250kSUBSv2". Is there a simple way to do this with model builder? I also have the Python code below, but I don't know how to code in Python (yet), so I'm not sure where I need to make changes, or even what changes to make. Thanks for your help!&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Python:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# -*- coding: utf-8 -*-&lt;/P&gt;&lt;P&gt;# ---------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;# DiatomScript.py&lt;/P&gt;&lt;P&gt;# Created on: 2015-02-25 10:39:32.00000&lt;/P&gt;&lt;P&gt;#&amp;nbsp;&amp;nbsp; (generated by ArcGIS/ModelBuilder)&lt;/P&gt;&lt;P&gt;# Usage: DiatomScript &amp;lt;DiatomPoints&amp;gt; &lt;/P&gt;&lt;P&gt;# Description: &lt;/P&gt;&lt;P&gt;# ---------------------------------------------------------------------------&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Import arcpy module&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Load required toolboxes&lt;/P&gt;&lt;P&gt;arcpy.ImportToolbox("Model Functions")&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Script arguments&lt;/P&gt;&lt;P&gt;DiatomPoints = arcpy.GetParameterAsText(0)&lt;/P&gt;&lt;P&gt;if DiatomPoints == '#' or not DiatomPoints:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DiatomPoints = "DiatomPoints" # provide a default value if unspecified&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Local variables:&lt;/P&gt;&lt;P&gt;DiatomPoints__2_ = DiatomPoints&lt;/P&gt;&lt;P&gt;Value = DiatomPoints__2_&lt;/P&gt;&lt;P&gt;huc250kSUBSv2__2_ = DiatomPoints__2_&lt;/P&gt;&lt;P&gt;DiatomData = huc250kSUBSv2__2_&lt;/P&gt;&lt;P&gt;huc250kSUBSv2 = "huc250kSUBSv2"&lt;/P&gt;&lt;P&gt;DiatomDiversity = "C:\\Users\\an997533\\Documents\\DiatomDiversity"&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Process: Select Layer By Attribute&lt;/P&gt;&lt;P&gt;arcpy.SelectLayerByAttribute_management(DiatomPoints, "NEW_SELECTION", "")&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Process: For&lt;/P&gt;&lt;P&gt;arcpy.IterateCount_mb("1", "48606", "1")&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Process: Select Layer By Location&lt;/P&gt;&lt;P&gt;arcpy.SelectLayerByLocation_management(huc250kSUBSv2, "INTERSECT", DiatomPoints__2_, "", "NEW_SELECTION")&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Process: Create Table&lt;/P&gt;&lt;P&gt;arcpy.CreateTable_management(DiatomDiversity, "DiatomData", "", "")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Feb 2015 16:52:54 GMT</pubDate>
    <dc:creator>ChristineButterfield</dc:creator>
    <dc:date>2015-02-25T16:52:54Z</dc:date>
    <item>
      <title>Model builder/python - creating a table with data from 2 shapefiles</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/model-builder-python-creating-a-table-with-data/m-p/818063#M3339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to automate a process to select polygons by location based on a different shapefile. This is the model I have built:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="/legacyfs/online/65389_Export Graphic.png"&gt;&lt;IMG alt="Export Graphic.png" class="image-1 jive-image" height="571" src="/legacyfs/online/65389_Export Graphic.png" style="width: 620px; height: 272px;" width="1301" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;This model seems to be running in an infinite loop. What I am trying to do instead is to have it run through each of my 48,000+ data points from "DiatomsPoints" and select the polygon from "huc250kSUBSv2" for each point. Then, I would like the information to be collated into a table which shows the data from "DiatomsPoints" and the corresponding polygon from "huc250kSUBSv2". Is there a simple way to do this with model builder? I also have the Python code below, but I don't know how to code in Python (yet), so I'm not sure where I need to make changes, or even what changes to make. Thanks for your help!&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Python:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# -*- coding: utf-8 -*-&lt;/P&gt;&lt;P&gt;# ---------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;# DiatomScript.py&lt;/P&gt;&lt;P&gt;# Created on: 2015-02-25 10:39:32.00000&lt;/P&gt;&lt;P&gt;#&amp;nbsp;&amp;nbsp; (generated by ArcGIS/ModelBuilder)&lt;/P&gt;&lt;P&gt;# Usage: DiatomScript &amp;lt;DiatomPoints&amp;gt; &lt;/P&gt;&lt;P&gt;# Description: &lt;/P&gt;&lt;P&gt;# ---------------------------------------------------------------------------&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Import arcpy module&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Load required toolboxes&lt;/P&gt;&lt;P&gt;arcpy.ImportToolbox("Model Functions")&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Script arguments&lt;/P&gt;&lt;P&gt;DiatomPoints = arcpy.GetParameterAsText(0)&lt;/P&gt;&lt;P&gt;if DiatomPoints == '#' or not DiatomPoints:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DiatomPoints = "DiatomPoints" # provide a default value if unspecified&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Local variables:&lt;/P&gt;&lt;P&gt;DiatomPoints__2_ = DiatomPoints&lt;/P&gt;&lt;P&gt;Value = DiatomPoints__2_&lt;/P&gt;&lt;P&gt;huc250kSUBSv2__2_ = DiatomPoints__2_&lt;/P&gt;&lt;P&gt;DiatomData = huc250kSUBSv2__2_&lt;/P&gt;&lt;P&gt;huc250kSUBSv2 = "huc250kSUBSv2"&lt;/P&gt;&lt;P&gt;DiatomDiversity = "C:\\Users\\an997533\\Documents\\DiatomDiversity"&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Process: Select Layer By Attribute&lt;/P&gt;&lt;P&gt;arcpy.SelectLayerByAttribute_management(DiatomPoints, "NEW_SELECTION", "")&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Process: For&lt;/P&gt;&lt;P&gt;arcpy.IterateCount_mb("1", "48606", "1")&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Process: Select Layer By Location&lt;/P&gt;&lt;P&gt;arcpy.SelectLayerByLocation_management(huc250kSUBSv2, "INTERSECT", DiatomPoints__2_, "", "NEW_SELECTION")&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Process: Create Table&lt;/P&gt;&lt;P&gt;arcpy.CreateTable_management(DiatomDiversity, "DiatomData", "", "")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Feb 2015 16:52:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/model-builder-python-creating-a-table-with-data/m-p/818063#M3339</guid>
      <dc:creator>ChristineButterfield</dc:creator>
      <dc:date>2015-02-25T16:52:54Z</dc:date>
    </item>
    <item>
      <title>Re: Model builder/python - creating a table with data from 2 shapefiles</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/model-builder-python-creating-a-table-with-data/m-p/818064#M3340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Christine,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can accomplish this using the &lt;A href="http://desktop.arcgis.com/en/desktop/latest/tools/analysis-toolbox/spatial-join.htm"&gt;Spatial Join&lt;/A&gt; tool w/o the need for a model or script.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Feb 2015 17:03:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/model-builder-python-creating-a-table-with-data/m-p/818064#M3340</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2015-02-25T17:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: Model builder/python - creating a table with data from 2 shapefiles</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/model-builder-python-creating-a-table-with-data/m-p/818065#M3341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I see you are trying to do this in Model Builder but a tool is already developed for this call Spatial Join.&amp;nbsp; You can join 2 feature classes based on a spatial relationship.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//005s00000032000000" title="http://resources.arcgis.com/en/help/main/10.1/index.html#//005s00000032000000"&gt;ArcGIS Help 10.1&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Feb 2015 17:04:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/model-builder-python-creating-a-table-with-data/m-p/818065#M3341</guid>
      <dc:creator>StevenGraf1</dc:creator>
      <dc:date>2015-02-25T17:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: Model builder/python - creating a table with data from 2 shapefiles</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/model-builder-python-creating-a-table-with-data/m-p/818066#M3342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you both for your help! That worked perfectly &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Feb 2015 17:30:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/model-builder-python-creating-a-table-with-data/m-p/818066#M3342</guid>
      <dc:creator>ChristineButterfield</dc:creator>
      <dc:date>2015-02-25T17:30:57Z</dc:date>
    </item>
  </channel>
</rss>

