<?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 py addin:  buffer error in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/py-addin-buffer-error/m-p/417041#M32784</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a python addin that has a tool, and a combo box.&amp;nbsp; the combo is quarter mile increments, so 0.25, 0.5, 0.75, 1, 1.25 etc.&amp;nbsp; The tool is just a map click.&amp;nbsp; This code creates the buffer where the user clicks, but it's 17 inches, not 1 Mile...&amp;nbsp; I'm going nuts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;def buildWebPage(x, y, cmboDistance):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'in buildWebPage def!'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; inpoint = arcpy.Point(X=x, Y=y)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ptGeometry = arcpy.PointGeometry(inpoint)&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sr = arcpy.SpatialReference(3566)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DefineProjection_management(ptGeometry, sr)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'define prj'&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Buffer_analysis(ptGeometry, "buffer", str(cmboDistance) + ' Miles')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'buffer complete'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Aug 2014 20:13:29 GMT</pubDate>
    <dc:creator>KevinBell</dc:creator>
    <dc:date>2014-08-11T20:13:29Z</dc:date>
    <item>
      <title>py addin:  buffer error</title>
      <link>https://community.esri.com/t5/python-questions/py-addin-buffer-error/m-p/417041#M32784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a python addin that has a tool, and a combo box.&amp;nbsp; the combo is quarter mile increments, so 0.25, 0.5, 0.75, 1, 1.25 etc.&amp;nbsp; The tool is just a map click.&amp;nbsp; This code creates the buffer where the user clicks, but it's 17 inches, not 1 Mile...&amp;nbsp; I'm going nuts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;def buildWebPage(x, y, cmboDistance):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'in buildWebPage def!'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; inpoint = arcpy.Point(X=x, Y=y)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ptGeometry = arcpy.PointGeometry(inpoint)&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sr = arcpy.SpatialReference(3566)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DefineProjection_management(ptGeometry, sr)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'define prj'&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Buffer_analysis(ptGeometry, "buffer", str(cmboDistance) + ' Miles')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'buffer complete'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2014 20:13:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/py-addin-buffer-error/m-p/417041#M32784</guid>
      <dc:creator>KevinBell</dc:creator>
      <dc:date>2014-08-11T20:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: py addin:  buffer error</title>
      <link>https://community.esri.com/t5/python-questions/py-addin-buffer-error/m-p/417042#M32785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried hard coding '1 Mile' instead of passing the distance in w/ the combo box.&amp;nbsp; Same result.&amp;nbsp; If I hardcode '5280 Feet' then it works.&amp;nbsp; hmmm.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2014 21:08:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/py-addin-buffer-error/m-p/417042#M32785</guid>
      <dc:creator>KevinBell</dc:creator>
      <dc:date>2014-08-11T21:08:24Z</dc:date>
    </item>
    <item>
      <title>Re: py addin:  buffer error</title>
      <link>https://community.esri.com/t5/python-questions/py-addin-buffer-error/m-p/417043#M32786</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could just take the cmboDistance variable and multiply it by 5280 in the function.&amp;nbsp; For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cmboDistanceFEET = float(cmboDistance)*5280&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; font-size: 12px;"&gt;arcpy.Buffer_analysis(ptGeometry, "buffer",cmboDistanceFEET)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; font-size: 12px;"&gt;Feeding the buffer tool the same units as the point spatial reference (ft) seems like good practice anyway.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; font-size: 12px;"&gt;If you have trouble with the math conversion, or want to put text (like 1/4, 1/2, 3/4, etc.) in the combobox, you can always use a dictionary to link those values to real numbers in feet.&amp;nbsp; For example:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;def buildWebPage(x, y, cmboDistance):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; val_dict = {"1/4":5280*.25,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "1/2":5280*.5,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "3/4":5280*.75}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; font-size: 12px;"&gt;arcpy.Buffer_analysis(ptGeometry, "buffer",val_dict[&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; font-size: 12px;"&gt;cmboDistance&lt;/SPAN&gt;])&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Aug 2014 14:10:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/py-addin-buffer-error/m-p/417043#M32786</guid>
      <dc:creator>AdamCox1</dc:creator>
      <dc:date>2014-08-12T14:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: py addin:  buffer error</title>
      <link>https://community.esri.com/t5/python-questions/py-addin-buffer-error/m-p/417044#M32787</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ya, did that but without the dictionary.&amp;nbsp; I'm not tagging your reply as the correct answer because I'm more reporting the issue.&amp;nbsp; The correct answer may be that this is a bug that needs to be fixed...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Aug 2014 14:19:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/py-addin-buffer-error/m-p/417044#M32787</guid>
      <dc:creator>KevinBell</dc:creator>
      <dc:date>2014-08-12T14:19:59Z</dc:date>
    </item>
  </channel>
</rss>

