Hi!
I would like to draw polygon on my map and afterwards add 1,5 m buffer to it. I managed to draw a polygon however I have no idea how to create a buffer. The idea is that a user of ArcGIS will draw a polygon and receive directly the buffer. Is that possible?
<SPAN class="keyword token">def</SPAN> <SPAN class="token function">onLine</SPAN><SPAN class="punctuation token">(</SPAN>self<SPAN class="punctuation token">,</SPAN> line_geometry<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
array <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>Array<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
part <SPAN class="operator token">=</SPAN> line_geometry<SPAN class="punctuation token">.</SPAN>getPart<SPAN class="punctuation token">(</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">for</SPAN> pt <SPAN class="keyword token">in</SPAN> part<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">print</SPAN> pt<SPAN class="punctuation token">.</SPAN>X<SPAN class="punctuation token">,</SPAN> pt<SPAN class="punctuation token">.</SPAN>Y
array<SPAN class="punctuation token">.</SPAN>add<SPAN class="punctuation token">(</SPAN>pt<SPAN class="punctuation token">)</SPAN>
array<SPAN class="punctuation token">.</SPAN>add<SPAN class="punctuation token">(</SPAN>line_geometry<SPAN class="punctuation token">.</SPAN>firstPoint<SPAN class="punctuation token">)</SPAN>
polygon <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>Polygon<SPAN class="punctuation token">(</SPAN>array<SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token"># Local Variables </SPAN>
Input <SPAN class="operator token">=</SPAN> polygon
NewPolygons <SPAN class="operator token">=</SPAN> <SPAN class="string token">"\\\\abc\\home\\xyz\\Documents\\moje dokumenty\\xyz\\arcgis\\new polygons"</SPAN>
<SPAN class="comment token"># Process: Append Polygon to existing file or Create new file if one is not created. </SPAN>
<SPAN class="keyword token">if</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>Exists<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"NewPolygons"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>Append_management<SPAN class="punctuation token">(</SPAN>Input<SPAN class="punctuation token">,</SPAN> NewPolygons<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"Test"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">""</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">else</SPAN><SPAN class="punctuation token">:</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>CopyFeatures_management<SPAN class="punctuation token">(</SPAN>Input<SPAN class="punctuation token">,</SPAN>NewPolygons<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"0"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">"0"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">"0"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN> <SPAN class="string token">" Excavation Polygon located"</SPAN> <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>