<?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: addin tool not selecting by location in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326825#M25411</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ESRI Tech support got me going!&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;def onRectangle(self, rectangle_geometry):&lt;BR /&gt; &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.MakeFeatureLayer_management('events', 'eventsLyr')&lt;BR /&gt; &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.SelectLayerByLocation_management('eventsLyr', 'INTERSECT',&lt;EM&gt;&lt;STRONG&gt;rectangle_geometry.polygon&lt;/STRONG&gt;&lt;/EM&gt;)&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;n = arcpy.GetCount_management('eventsLyr')&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;f = open(r'E:\ArcMap\BuildingServices\20180411_misassignedInspectors\addin\log.txt','a')&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;f.write(str(n) + '\n')&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;f.close()&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.Delete_management('selectLyr')&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.Delete_management('eventsLyr')&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 23 Apr 2018 15:15:16 GMT</pubDate>
    <dc:creator>KevinBell1</dc:creator>
    <dc:date>2018-04-23T15:15:16Z</dc:date>
    <item>
      <title>addin tool not selecting by location</title>
      <link>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326813#M25399</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm making a python addin select tool that allows the user to draw a rectangle and then select points within it to then do stuff.&amp;nbsp; For testing I'm only counting how many points are selected and writing to a log file, but it always returns 0... What am I doing wrong here?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;def onRectangle(self, rectangle_geometry):&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;ext = rectangle_geometry&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;array = arcpy.Array() &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;array.add(arcpy.Point(ext.XMin, ext.YMin)) &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;array.add(arcpy.Point(ext.XMin, ext.YMax)) &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;array.add(arcpy.Point(ext.XMax, ext.YMax)) &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;array.add(arcpy.Point(ext.XMax, ext.YMin)) &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;array.add(arcpy.Point(ext.XMin, ext.YMin)) &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;polygon = arcpy.Polygon(array) &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.CopyFeatures_management(polygon, "in_memory//Polygon_Extent") &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.MakeFeatureLayer_management("in_memory//Polygon_Extent", 'selectLyr')&lt;BR /&gt; &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.MakeFeatureLayer_management('events', 'eventsLyr')&lt;BR /&gt; &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.SelectLayerByLocation_management('eventsLyr', 'INTERSECT','selectLyr')&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;n = arcpy.GetCount_management('eventsLyr')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;f = open(r'E:\ArcMap\BuildingServices\20180411_misassignedInspectors\addin\log.txt','a')&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;f.write(str(n) + '\n')&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;f.close()&lt;BR /&gt; &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.Delete_management("in_memory//Polygon_Extent")&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.Delete_management('selectLyr')&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.Delete_management('eventsLyr')&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Apr 2018 15:09:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326813#M25399</guid>
      <dc:creator>KevinBell1</dc:creator>
      <dc:date>2018-04-13T15:09:18Z</dc:date>
    </item>
    <item>
      <title>Re: addin tool not selecting by location</title>
      <link>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326814#M25400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is everything in the same coordinate system? since getcount honors the extent environment parameter, so it may not be selecting anything because of that.&lt;/P&gt;&lt;P&gt;You would also be wise to add the extent parameters and anything else useful to your output text file&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Apr 2018 16:17:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326814#M25400</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-04-13T16:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: addin tool not selecting by location</title>
      <link>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326815#M25401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This isn't even working:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;def onRectangle(self, rectangle_geometry):&lt;BR /&gt; &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ext = rectangle_geometry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;f = open('log.txt','a')&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;f.write(ext.XMin, ext.XMax, ext.YMin, ext.YMax)&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;f.close()&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Apr 2018 16:34:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326815#M25401</guid>
      <dc:creator>KevinBell1</dc:creator>
      <dc:date>2018-04-13T16:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: addin tool not selecting by location</title>
      <link>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326816#M25402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Kevin-&amp;nbsp; not sure if this'll help, but here's a snippet I use to create a single polygon based on data frame extent:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;mxd &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MapDocument&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"CURRENT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
df &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListDataFrames&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mxd&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
frameExtent &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; df&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;extent
XMAX &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; frameExtent&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;XMax
XMIN &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; frameExtent&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;XMin
YMAX &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; frameExtent&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;YMax
YMIN &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; frameExtent&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;YMin
&lt;SPAN class="comment token"&gt;#&lt;/SPAN&gt;
pnt1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Point&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;XMIN&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; YMIN&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
pnt2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Point&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;XMIN&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; YMAX&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
pnt3 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Point&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;XMAX&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; YMAX&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
pnt4 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Point&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;XMAX&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; YMIN&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#&lt;/SPAN&gt;
array &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Array&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
array&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;add&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;pnt1&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
array&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;add&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;pnt2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
array&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;add&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;pnt3&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
array&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;add&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;pnt4&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
array&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;add&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;pnt1&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
Mypolygon &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Polygon&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;array&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CopyFeatures_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Mypolygon&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"in_memory\\ExtentPoly"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
in_poly_layer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListLayers&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mxd&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"ExtentPoly"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;df&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:29:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326816#M25402</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-12-11T15:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: addin tool not selecting by location</title>
      <link>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326817#M25403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ya, that code from JSchiener (sp?) was what I started with before violating the zen of python by nesting it rather than keeping it flat!&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Apr 2018 21:19:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326817#M25403</guid>
      <dc:creator>KevinBell1</dc:creator>
      <dc:date>2018-04-13T21:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: addin tool not selecting by location</title>
      <link>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326818#M25404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As a test, do you get a count if you check just before the SelectByLocation?&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeFeatureLayer_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'events'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'eventsLyr'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# check here to see if layer has a count&lt;/SPAN&gt;
n &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetCount_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'eventsLyr'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; n

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByLocation_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'eventsLyr'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'INTERSECT'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'selectLyr'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:29:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326818#M25404</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-12-11T15:29:48Z</dc:date>
    </item>
    <item>
      <title>Re: addin tool not selecting by location</title>
      <link>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326819#M25405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes!&amp;nbsp; I do get a count if I forego the selection.&amp;nbsp; If I do the select by location the count is zero, with out it 258 which is correct.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2018 16:24:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326819#M25405</guid>
      <dc:creator>KevinBell1</dc:creator>
      <dc:date>2018-04-16T16:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: addin tool not selecting by location</title>
      <link>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326820#M25406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How can I ensure the coordinate systems are the same.&amp;nbsp; That's got to be it, but I'm stuck.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The map where the tool is used is in state plane, and the event layer is projecting on the fly from wgs 84.&amp;nbsp; When I'm creating the feature layer for the events there's no option to specify a different coordinate system.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2018 16:35:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326820#M25406</guid>
      <dc:creator>KevinBell1</dc:creator>
      <dc:date>2018-04-16T16:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: addin tool not selecting by location</title>
      <link>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326821#M25407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Keven... Projecting on the fly does nothing but make things look nice on screen and give you a false sense that things are as they should be.&lt;/P&gt;&lt;P&gt;Make the event layer a featureclass, then Project it to the appropriate projection ... or ... unproject the thing that you are trying to use in the selection process so it matches the decimal degree data.&amp;nbsp; Once everything is in the same coordinate system (either projected or geographic) proceed with spatial selections.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2018 16:41:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326821#M25407</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-04-16T16:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: addin tool not selecting by location</title>
      <link>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326822#M25408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Coordinate systems is&amp;nbsp;GCS_WGS_1984 in the map, and I added&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sr = arcpy.SpatialReference(4326)&lt;BR /&gt; polygon = arcpy.Polygon(array, sr)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And now I see in the properties that the coord sys are identical but I still get no entry in my log.&amp;nbsp; I do log data from this addin's combo box selection change, but not this.&amp;nbsp; Here's what I'm running.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;def onRectangle(self, rectangle_geometry):&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;ext = rectangle_geometry&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;array = arcpy.Array() &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;array.add(arcpy.Point(ext.XMin, ext.YMin)) &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;array.add(arcpy.Point(ext.XMin, ext.YMax)) &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;array.add(arcpy.Point(ext.XMax, ext.YMax)) &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;array.add(arcpy.Point(ext.XMax, ext.YMin)) &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;array.add(arcpy.Point(ext.XMin, ext.YMin)) &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;sr = arcpy.SpatialReference(4326)&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;polygon = arcpy.Polygon(array, sr) &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.CopyFeatures_management(polygon, "in_memory//Polygon_Extent") &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.MakeFeatureLayer_management("in_memory//Polygon_Extent", 'selectLyr')&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.MakeFeatureLayer_management('events', 'eventsLyr')&lt;BR /&gt; &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;f = open(r'E:\ArcMap\BuildingServices\20180411_misassignedInspectors\addin\log.txt','a')&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;f.write('what the hell?')&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;f.close()&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.Delete_management("in_memory//Polygon_Extent")&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.Delete_management('selectLyr')&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.Delete_management('eventsLyr')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nothing is written to the log, but the polygon is created in the map, so the def is running.&amp;nbsp; : (&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2018 17:14:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326822#M25408</guid>
      <dc:creator>KevinBell1</dc:creator>
      <dc:date>2018-04-16T17:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: addin tool not selecting by location</title>
      <link>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326823#M25409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Print the coordinates... again, you can define anything what you want, it doesn't make it so. &amp;nbsp;&lt;/P&gt;&lt;P&gt;And you are appending to an existing file in your file.open, is that correct?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2018 17:28:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326823#M25409</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-04-16T17:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: addin tool not selecting by location</title>
      <link>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326824#M25410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Changed &lt;SPAN style="background-color: #ffffff;"&gt;&amp;nbsp;&lt;STRONG&gt;f.write('what the hell?')&lt;/STRONG&gt; to&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;f.write(ext.XMin, ext.YMin)&lt;/STRONG&gt; and nothing is written to the log file that is open to append.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2018 17:39:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326824#M25410</guid>
      <dc:creator>KevinBell1</dc:creator>
      <dc:date>2018-04-16T17:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: addin tool not selecting by location</title>
      <link>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326825#M25411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ESRI Tech support got me going!&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;def onRectangle(self, rectangle_geometry):&lt;BR /&gt; &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.MakeFeatureLayer_management('events', 'eventsLyr')&lt;BR /&gt; &lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.SelectLayerByLocation_management('eventsLyr', 'INTERSECT',&lt;EM&gt;&lt;STRONG&gt;rectangle_geometry.polygon&lt;/STRONG&gt;&lt;/EM&gt;)&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;n = arcpy.GetCount_management('eventsLyr')&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;f = open(r'E:\ArcMap\BuildingServices\20180411_misassignedInspectors\addin\log.txt','a')&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;f.write(str(n) + '\n')&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;f.close()&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.Delete_management('selectLyr')&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.Delete_management('eventsLyr')&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Apr 2018 15:15:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/addin-tool-not-selecting-by-location/m-p/326825#M25411</guid>
      <dc:creator>KevinBell1</dc:creator>
      <dc:date>2018-04-23T15:15:16Z</dc:date>
    </item>
  </channel>
</rss>

