<?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 arcpy Multiple Ring Buffer analysis slow in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-multiple-ring-buffer-analysis-slow/m-p/262609#M20224</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have scrip that does a multiple ring buffer and it takes 2-3 minutes to run but i use the Buffer wizard in Arcmap it takes maybe a second. Is there a different better/faster way of doing a multiple ring buffer?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There isn't much to the the arcpy multiple ring buffer.&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14636770013668363" data-renderedposition="134_50_798_16" jivemacro_uid="_14636770013668363"&gt;&lt;P&gt;arcpy.MultipleRingBuffer_analysis(SP, "1_2",[1,2],"Miles","ToBufDist","ALL" )&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 May 2016 17:01:54 GMT</pubDate>
    <dc:creator>CCWeedcontrol</dc:creator>
    <dc:date>2016-05-19T17:01:54Z</dc:date>
    <item>
      <title>arcpy Multiple Ring Buffer analysis slow</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-multiple-ring-buffer-analysis-slow/m-p/262609#M20224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have scrip that does a multiple ring buffer and it takes 2-3 minutes to run but i use the Buffer wizard in Arcmap it takes maybe a second. Is there a different better/faster way of doing a multiple ring buffer?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There isn't much to the the arcpy multiple ring buffer.&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14636770013668363" data-renderedposition="134_50_798_16" jivemacro_uid="_14636770013668363"&gt;&lt;P&gt;arcpy.MultipleRingBuffer_analysis(SP, "1_2",[1,2],"Miles","ToBufDist","ALL" )&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 May 2016 17:01:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-multiple-ring-buffer-analysis-slow/m-p/262609#M20224</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2016-05-19T17:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy Multiple Ring Buffer analysis slow</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-multiple-ring-buffer-analysis-slow/m-p/262610#M20225</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the inputs and environments are all the same, no.&amp;nbsp; The arcpy access calls the same underlying code, eventually, the delays may be in accessing the underlying code.&amp;nbsp; Direct access will always be faster&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 May 2016 17:15:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-multiple-ring-buffer-analysis-slow/m-p/262610#M20225</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-05-19T17:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy Multiple Ring Buffer analysis slow</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-multiple-ring-buffer-analysis-slow/m-p/262611#M20226</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It actually calls a script tool, it has a "script" icon&lt;/P&gt;&lt;P&gt;&lt;IMG alt="a.png" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/201501_a.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 May 2016 17:28:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-multiple-ring-buffer-analysis-slow/m-p/262611#M20226</guid>
      <dc:creator>SteveLynch</dc:creator>
      <dc:date>2016-05-19T17:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy Multiple Ring Buffer analysis slow</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-multiple-ring-buffer-analysis-slow/m-p/262612#M20227</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;which means it is the fluff around the call that is slowing it down&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 May 2016 17:43:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-multiple-ring-buffer-analysis-slow/m-p/262612#M20227</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-05-19T17:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy Multiple Ring Buffer analysis slow</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-multiple-ring-buffer-analysis-slow/m-p/262613#M20228</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I did find that some one did try to use dictionary to store the ring buffer and create an insert cursor.&lt;/P&gt;&lt;P&gt;Alough my inputlayer doens't have a distance field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import string
import os
from datetime import datetime as d
startTime = d.now()

mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
lyr = arcpy.mapping.ListLayers(mxd, "SUBJECT_PROPERTY")[0]

arcpy.env.workspace = os.path.dirname(mxd.filePath)
wp = os.path.dirname(mxd.filePath)

inputLayer = "SUBJECT_PROPERTY"
outputLayer = "1_2"

def MultiRingBuffer(ringDistance, ringCount, inputLayer, outputLayer):
&amp;nbsp;&amp;nbsp;&amp;nbsp; buffers = []

&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor = arcpy.SearchCursor(inputLayer)
&amp;nbsp;&amp;nbsp;&amp;nbsp; for inputFeature in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sourceOid = inputFeature.getValue("FID")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; currentBuffers = dict()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; buffers.append(currentBuffers)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; prevBuffer = inputFeature.Shape

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for multiple in range(1, ringCount + 1):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; distance = multiple * ringDistance
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bufferedGeom = inputFeature.Shape.buffer(distance)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bufGeom = bufferedGeom.difference(prevBuffer)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; prevBuffer = bufferedGeom
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row = dict()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row["FID"] = sourceOid
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row["distance"] = distance
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row["SHAPE"] = bufGeom
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; currentBuffers[distance] = row
&amp;nbsp;&amp;nbsp;&amp;nbsp; del cursor

&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor = arcpy.InsertCursor(outputLayer)
&amp;nbsp;&amp;nbsp;&amp;nbsp; for ringBuffers in buffers:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for feature in ringBuffers.values():
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row = cursor.newRow()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for k in feature.keys():
&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; if k == "SHAPE":
&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; row.Shape = feature&lt;K&gt;&lt;/K&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; else:
&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; row.setValue(k, feature&lt;K&gt;)&lt;/K&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.insertRow(row)
&amp;nbsp;&amp;nbsp;&amp;nbsp; del cursor

if __name__ == '__main__':
&amp;nbsp;&amp;nbsp;&amp;nbsp; MultiRingBuffer(1, 2, "SUBJECT_PROPERTY" ,"1_2")
&amp;nbsp;&amp;nbsp;&amp;nbsp; print("Complete")&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:52:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-multiple-ring-buffer-analysis-slow/m-p/262613#M20228</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2021-12-11T12:52:57Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy Multiple Ring Buffer analysis slow</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-multiple-ring-buffer-analysis-slow/m-p/262614#M20229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm getting some strange results in ArcMap 10.4, when I compare the time to buffer multi rings (1 and 2 miles) using a point featureclass with 1000 and 10000 features as a stand alone script, executing the same script in Python window and manually executing the tool:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;TABLE border="1px" cellpadding="0" cellspacing="0" jive-data-cell="{&amp;quot;color&amp;quot;:&amp;quot;#606060&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;start&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;NaN&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;transparent&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif&amp;quot;,&amp;quot;verticalAlign&amp;quot;:&amp;quot;baseline&amp;quot;}" jive-data-header="{&amp;quot;color&amp;quot;:&amp;quot;#505050&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;#F2F2F2&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;6&amp;quot;}" style="border-width: 1px; border-style: solid; width: 444px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="20" width="80"&gt;# features&lt;/TD&gt;&lt;TD width="118"&gt;Stand alone script&lt;/TD&gt;&lt;TD width="106"&gt;Python Window&lt;/TD&gt;&lt;TD width="80"&gt;Toolbox&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1000&lt;/TD&gt;&lt;TD align="right"&gt;40&lt;/TD&gt;&lt;TD align="right"&gt;34&lt;/TD&gt;&lt;TD align="right"&gt;22&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;10000&lt;/TD&gt;&lt;TD align="right"&gt;247&lt;/TD&gt;&lt;TD align="right"&gt;234&lt;/TD&gt;&lt;TD align="right"&gt;288&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When using the stand alone script versus the same script (writing to different output) the standalone script will take some additional seconds to load arcpy. Using the toolbox was faster for 1000 points, but when using 10000 points the toolbox took more time than the scripts!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are many factors that influence the process when executed in ArcMap (geoprocessing&amp;nbsp; environment settings, coordinate systems (data vs dataframe), etc).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the script I used for the test:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;from time import strftime
print 'start:', strftime("%Y-%m-%d %H:%M:%S")

import arcpy
print 'arcpy loaded:', strftime("%Y-%m-%d %H:%M:%S")

fc_in = r'D:\Xander\GeoNet\SpeedBufMultiRing\data.gdb\input_points'
fc_out = r'D:\Xander\GeoNet\SpeedBufMultiRing\data.gdb\test01'
print 'vars set:', strftime("%Y-%m-%d %H:%M:%S")

arcpy.MultipleRingBuffer_analysis(fc_in, fc_out, [1,2], "Miles", "ToBufDist", "ALL")

print 'ended:', strftime("%Y-%m-%d %H:%M:%S")&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wouldn't go for the script you posted since that will likely take more time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:53:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-multiple-ring-buffer-analysis-slow/m-p/262614#M20229</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T12:53:00Z</dc:date>
    </item>
  </channel>
</rss>

