<?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: Select Data from one feature based on a different feature that is selected in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/select-data-from-one-feature-based-on-a-different/m-p/703370#M23327</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Not sure if this is what you're after&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Outer loop though feature class to extract an attribute from specified field&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Use value to construct 'where' clause&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Inner loop selects features(s) in second feature class&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Selection syntax is assuming a string field in a shapefile and I'm using ArcGIS 9.2&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcgisscripting
gp = arcgisscripting.create()
gp.OverwriteOutput = 1

fcPoly = "C:/test_polygons.shp"
fcPoint = "C:/test_points.shp"
myField = "TEST_FIELD"

gp.MakeFeatureLayer(fcPoint,"fcPoint_lyr")

outers = gp.SearchCursor(fcPoly)
outer = outers.Next()
# Print road name and road type
while outer:
&amp;nbsp;&amp;nbsp;&amp;nbsp; myVal = outer.GetValue(myField)

&amp;nbsp;&amp;nbsp;&amp;nbsp; strWhere = '"' + myField + '"' + " = '" + myVal + "'"&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.SelectLayerbyAttribute_management("fcPoint_lyr", "NEW_SELECTION", strWhere)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; inners = gp.SearchCursor("fcPoint_lyr")
&amp;nbsp;&amp;nbsp;&amp;nbsp; inner = inners.Next()
&amp;nbsp;&amp;nbsp;&amp;nbsp; while inner:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # do stuff here with the selected rows
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; inner = inners.Next()&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; outer = outers.Next()

print "done looping"&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 05:34:33 GMT</pubDate>
    <dc:creator>DarshaHardy</dc:creator>
    <dc:date>2021-12-12T05:34:33Z</dc:date>
    <item>
      <title>Select Data from one feature based on a different feature that is selected</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/select-data-from-one-feature-based-on-a-different/m-p/703369#M23326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Anyone have any suggestion of how to select a point feature by attribute based upon a selected polygon feature.&amp;nbsp; Both features have identical fields that correspond to each other but I can't get them to talk to one another.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The purpose of the tool is to select a polling location based upon the user's address.&amp;nbsp; I have the model/script to select the voting precinct, but now need to select the polling location based on that selected voting precinct.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 May 2010 12:19:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/select-data-from-one-feature-based-on-a-different/m-p/703369#M23326</guid>
      <dc:creator>PaulMcBride</dc:creator>
      <dc:date>2010-05-07T12:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: Select Data from one feature based on a different feature that is selected</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/select-data-from-one-feature-based-on-a-different/m-p/703370#M23327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Not sure if this is what you're after&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Outer loop though feature class to extract an attribute from specified field&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Use value to construct 'where' clause&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Inner loop selects features(s) in second feature class&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Selection syntax is assuming a string field in a shapefile and I'm using ArcGIS 9.2&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcgisscripting
gp = arcgisscripting.create()
gp.OverwriteOutput = 1

fcPoly = "C:/test_polygons.shp"
fcPoint = "C:/test_points.shp"
myField = "TEST_FIELD"

gp.MakeFeatureLayer(fcPoint,"fcPoint_lyr")

outers = gp.SearchCursor(fcPoly)
outer = outers.Next()
# Print road name and road type
while outer:
&amp;nbsp;&amp;nbsp;&amp;nbsp; myVal = outer.GetValue(myField)

&amp;nbsp;&amp;nbsp;&amp;nbsp; strWhere = '"' + myField + '"' + " = '" + myVal + "'"&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.SelectLayerbyAttribute_management("fcPoint_lyr", "NEW_SELECTION", strWhere)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; inners = gp.SearchCursor("fcPoint_lyr")
&amp;nbsp;&amp;nbsp;&amp;nbsp; inner = inners.Next()
&amp;nbsp;&amp;nbsp;&amp;nbsp; while inner:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # do stuff here with the selected rows
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; inner = inners.Next()&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; outer = outers.Next()

print "done looping"&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:34:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/select-data-from-one-feature-based-on-a-different/m-p/703370#M23327</guid>
      <dc:creator>DarshaHardy</dc:creator>
      <dc:date>2021-12-12T05:34:33Z</dc:date>
    </item>
  </channel>
</rss>

