<?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: Extent env. ignored by Select Layer by Attribute in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/extent-env-ignored-by-select-layer-by-attribute/m-p/494517#M16475</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you both!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I gave the answer to Jake since that solution actually did the selection.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I had been thinking that Jake's solution required creating a feature class (or at least a feature) somewhere, but then I realized that this uses an on-the-fly geometry as discussed at the top of the &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018z00000070000000" rel="nofollow noopener noreferrer" target="_blank"&gt;Geometry class help page&lt;/A&gt;&lt;SPAN&gt;.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'd read William's post first, and so researched the extent method. Based on that I tried this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;mxd = arcpy.mapping.MapDocument("CURRENT")
df&amp;nbsp; = arcpy.mapping.ListDataFrames(mxd)[0]

extent = df.extent
grids = arcpy.da.SearchCursor("Clip_Grid",("SHAPE@","PageName"))
for grid in grids:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (extent.contains(grid[0])) or (extent.overlaps(grid[0])) or (extent.within(grid[0])):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print grid[1]
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And that successfully prints out each PageName value in the equivalent of an intersect.&amp;nbsp; As a side point, why is there no simple "intersects" method?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PS: Oh, there's still the question of whether or not the extent environment parameter for the Select Layer by Attribute tool is actually broken.&amp;nbsp; Jake?&amp;nbsp; Based on your logo, can you answer that just for curiosity?&amp;nbsp; (either way though, thank you for the work-around).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 21:46:10 GMT</pubDate>
    <dc:creator>StormwaterWater_Resources</dc:creator>
    <dc:date>2021-12-11T21:46:10Z</dc:date>
    <item>
      <title>Extent env. ignored by Select Layer by Attribute</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/extent-env-ignored-by-select-layer-by-attribute/m-p/494514#M16472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I tried refreshing an old post (&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://forums.arcgis.com/threads/33613-Select-Layer-by-Attribute-with-Extent-environment-paramater" rel="nofollow" target="_blank"&gt;Select Layer by Attribute with Extent environment parameter&lt;/A&gt;&lt;SPAN&gt;) on this topic, but it doesn't seem to be attracting any attention.&amp;nbsp; I'm trying to restrict a Select Layer by Attribute to my display extent.&amp;nbsp; This is clearly outlined on the &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/main/10.1/index.html#//001700000071000000" rel="nofollow" target="_blank"&gt;help page (3rd bullet pt)&lt;/A&gt;&lt;SPAN&gt;.&amp;nbsp; No matter how I use the tool (stand-alone, in a model, via Python) it always selects everything.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Since I want to select everything in the current display extent I'm using this SQL expression:&amp;nbsp;&amp;nbsp; "OID" = "OID"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This seems like such a handy feature that I find it hard to believe others haven't had this problem, so I'm wondering if it's me.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;10.1, Win 7 64&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PS: I'm curious if others have this problem, but I'll green check anyone who gives me an alternate "Select All in Display" tool/method. (obviously this is going to be geo-processed so "use the mouse" will not get a green check&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Dec 2013 11:44:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/extent-env-ignored-by-select-layer-by-attribute/m-p/494514#M16472</guid>
      <dc:creator>StormwaterWater_Resources</dc:creator>
      <dc:date>2013-12-12T11:44:58Z</dc:date>
    </item>
    <item>
      <title>Re: Extent env. ignored by Select Layer by Attribute</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/extent-env-ignored-by-select-layer-by-attribute/m-p/494515#M16473</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;One thing you could do is create a polygon from the data frame's extent, and then perform a Select Layer by Location to select all features that intersect the polygon.&amp;nbsp; Ex:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy from arcpy import env from arcpy import mapping&amp;nbsp; mxd = mapping.MapDocument("CURRENT") df = mapping.ListDataFrames(mxd)[0]&amp;nbsp; #create polygon from data frame extent XMAX = df.extent.XMax XMIN = df.extent.XMin YMAX = df.extent.YMax YMIN = df.extent.YMin pnt1 = arcpy.Point(XMIN, YMIN) pnt2 = arcpy.Point(XMIN, YMAX) pnt3 = arcpy.Point(XMAX, YMAX) pnt4 = arcpy.Point(XMAX, YMIN) array = arcpy.Array() array.add(pnt1) array.add(pnt2) array.add(pnt3) array.add(pnt4) array.add(pnt1) polygon = arcpy.Polygon(array)&amp;nbsp; #select features that intersect polygon arcpy.SelectLayerByLocation_management("Airports", "INTERSECT", polygon)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Dec 2013 13:18:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/extent-env-ignored-by-select-layer-by-attribute/m-p/494515#M16473</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2013-12-12T13:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: Extent env. ignored by Select Layer by Attribute</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/extent-env-ignored-by-select-layer-by-attribute/m-p/494516#M16474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Quite similar to what Jake proposed, you may be able to grab the bounding box of the dataframe's extent this way:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;map_document = arcpy.mapping.MapDocument("current")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dataframe = arcpy.mapping.ListDataFrames(map_document, map_document.activeView)[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;extent = dataframe.extent&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can then pass the extent's bounding box as parameters to the next geoprocessing tool in your Python script.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Dec 2013 13:30:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/extent-env-ignored-by-select-layer-by-attribute/m-p/494516#M16474</guid>
      <dc:creator>WilliamCraft</dc:creator>
      <dc:date>2013-12-12T13:30:57Z</dc:date>
    </item>
    <item>
      <title>Re: Extent env. ignored by Select Layer by Attribute</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/extent-env-ignored-by-select-layer-by-attribute/m-p/494517#M16475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you both!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I gave the answer to Jake since that solution actually did the selection.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I had been thinking that Jake's solution required creating a feature class (or at least a feature) somewhere, but then I realized that this uses an on-the-fly geometry as discussed at the top of the &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018z00000070000000" rel="nofollow noopener noreferrer" target="_blank"&gt;Geometry class help page&lt;/A&gt;&lt;SPAN&gt;.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'd read William's post first, and so researched the extent method. Based on that I tried this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;mxd = arcpy.mapping.MapDocument("CURRENT")
df&amp;nbsp; = arcpy.mapping.ListDataFrames(mxd)[0]

extent = df.extent
grids = arcpy.da.SearchCursor("Clip_Grid",("SHAPE@","PageName"))
for grid in grids:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (extent.contains(grid[0])) or (extent.overlaps(grid[0])) or (extent.within(grid[0])):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print grid[1]
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And that successfully prints out each PageName value in the equivalent of an intersect.&amp;nbsp; As a side point, why is there no simple "intersects" method?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PS: Oh, there's still the question of whether or not the extent environment parameter for the Select Layer by Attribute tool is actually broken.&amp;nbsp; Jake?&amp;nbsp; Based on your logo, can you answer that just for curiosity?&amp;nbsp; (either way though, thank you for the work-around).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:46:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/extent-env-ignored-by-select-layer-by-attribute/m-p/494517#M16475</guid>
      <dc:creator>StormwaterWater_Resources</dc:creator>
      <dc:date>2021-12-11T21:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: Extent env. ignored by Select Layer by Attribute</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/extent-env-ignored-by-select-layer-by-attribute/m-p/494518#M16476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I believe that is a typo within the help.&amp;nbsp; If you look under 'Environments' on the help page, EXTENT is not listed.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Dec 2013 16:44:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/extent-env-ignored-by-select-layer-by-attribute/m-p/494518#M16476</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2013-12-12T16:44:43Z</dc:date>
    </item>
  </channel>
</rss>

