<?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: Python: How do I use a list loop with the buffer analysis tool to create three buffer zones with user input distance in feet? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-how-do-i-use-a-list-loop-with-the-buffer/m-p/306483#M23801</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;#set a list of 100, 200 and 300ft&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#variables should be snake case btw...&lt;/SPAN&gt;

distanceList &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;100&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;200&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;300&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#buffer river by ieterating values supplied in distanceList&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#for every number in distanceList, input this numbe as a variable in the &lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#buffer function below&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#within the for loop, the 'distance' variable will represent a distance in your list&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#If you dont pass this in with 'Feet' it will default to metres&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#for the out_feature_class, I'll take this distance value, covert it to a string (str)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#and add it on to the end of the buffer name (concatenating).&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; distance &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; distance_List&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;

    out_feature_class &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"riverbuffer_"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;distance&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"_ft"&lt;/SPAN&gt;
    
    &lt;SPAN class="comment token"&gt;# turn your distance into a string with 'Feet' on the end&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;#e.g. "100 Feet"&lt;/SPAN&gt;
    distance_ft &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;distance&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" Feet"&lt;/SPAN&gt;

    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Buffer_analysis&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;in_features&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; out_feature_class&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; distance_ft&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"buffer for distance "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; distance_ft &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" is done"&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;/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 14:40:07 GMT</pubDate>
    <dc:creator>DavidPike</dc:creator>
    <dc:date>2021-12-11T14:40:07Z</dc:date>
    <item>
      <title>Python: How do I use a list loop with the buffer analysis tool to create three buffer zones with user input distance in feet?</title>
      <link>https://community.esri.com/t5/python-questions/python-how-do-i-use-a-list-loop-with-the-buffer/m-p/306480#M23798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I can make my analysis work if I can fill in the blanks. &amp;nbsp;I know the first two and the distanceList values, but beyond that everything I have tried does not work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 29 Feb 2020 17:59:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-how-do-i-use-a-list-loop-with-the-buffer/m-p/306480#M23798</guid>
      <dc:creator>CateEliz</dc:creator>
      <dc:date>2020-02-29T17:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: Python: How do I use a list loop with the buffer analysis tool to create three buffer zones with user input distance in feet?</title>
      <link>https://community.esri.com/t5/python-questions/python-how-do-i-use-a-list-loop-with-the-buffer/m-p/306481#M23799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This will be very simple, however please provide more info such as the intro to your homework and your data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 29 Feb 2020 18:27:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-how-do-i-use-a-list-loop-with-the-buffer/m-p/306481#M23799</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-02-29T18:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: Python: How do I use a list loop with the buffer analysis tool to create three buffer zones with user input distance in feet?</title>
      <link>https://community.esri.com/t5/python-questions/python-how-do-i-use-a-list-loop-with-the-buffer/m-p/306482#M23800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The directions are not very detailed. &amp;nbsp;It says I am to use river.shp as the input and I can define any distances as long as they are in feet. It says to provide user input for the three parameters when implementing the data in PythonWin and each buffer should be named based on its buffer distance (ex. river100).&lt;/P&gt;&lt;P&gt;I attached the python code to the original question and here is an example of the river.shp data.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji image-1 jive-image j-img-original" src="/legacyfs/online/483694_Screen Shot 2020-02-29 at 12.35.22 PM.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 29 Feb 2020 18:38:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-how-do-i-use-a-list-loop-with-the-buffer/m-p/306482#M23800</guid>
      <dc:creator>CateEliz</dc:creator>
      <dc:date>2020-02-29T18:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: Python: How do I use a list loop with the buffer analysis tool to create three buffer zones with user input distance in feet?</title>
      <link>https://community.esri.com/t5/python-questions/python-how-do-i-use-a-list-loop-with-the-buffer/m-p/306483#M23801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;#set a list of 100, 200 and 300ft&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#variables should be snake case btw...&lt;/SPAN&gt;

distanceList &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;100&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;200&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;300&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#buffer river by ieterating values supplied in distanceList&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#for every number in distanceList, input this numbe as a variable in the &lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#buffer function below&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#within the for loop, the 'distance' variable will represent a distance in your list&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#If you dont pass this in with 'Feet' it will default to metres&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#for the out_feature_class, I'll take this distance value, covert it to a string (str)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#and add it on to the end of the buffer name (concatenating).&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; distance &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; distance_List&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;

    out_feature_class &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"riverbuffer_"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;distance&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"_ft"&lt;/SPAN&gt;
    
    &lt;SPAN class="comment token"&gt;# turn your distance into a string with 'Feet' on the end&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;#e.g. "100 Feet"&lt;/SPAN&gt;
    distance_ft &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;distance&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" Feet"&lt;/SPAN&gt;

    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Buffer_analysis&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;in_features&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; out_feature_class&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; distance_ft&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"buffer for distance "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; distance_ft &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" is done"&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;/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 14:40:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-how-do-i-use-a-list-loop-with-the-buffer/m-p/306483#M23801</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-12-11T14:40:07Z</dc:date>
    </item>
    <item>
      <title>Re: Python: How do I use a list loop with the buffer analysis tool to create three buffer zones with user input distance in feet?</title>
      <link>https://community.esri.com/t5/python-questions/python-how-do-i-use-a-list-loop-with-the-buffer/m-p/306484#M23802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much! &amp;nbsp;What you did makes sense. &amp;nbsp;I am trying to fit that to the template I have since I am only supposed to fill in the blanks, but I cannot figure out how to fill the three middle lines without having to change the rest of the code, which I do not think we are supposed to do. &amp;nbsp;All of the lines are to have something filled in, but those three do not seem necessary for it to work, so I am not sure what would go there. Possibly argument variables? &amp;nbsp;But I think if I did that then I would need to also import sys and change the parameters listed within the buffer analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji image-1 jive-image j-img-original" src="/legacyfs/online/483738_Screen Shot 2020-02-29 at 6.47.20 PM.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Mar 2020 00:51:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-how-do-i-use-a-list-loop-with-the-buffer/m-p/306484#M23802</guid>
      <dc:creator>CateEliz</dc:creator>
      <dc:date>2020-03-01T00:51:55Z</dc:date>
    </item>
    <item>
      <title>Re: Python: How do I use a list loop with the buffer analysis tool to create three buffer zones with user input distance in feet?</title>
      <link>https://community.esri.com/t5/python-questions/python-how-do-i-use-a-list-loop-with-the-buffer/m-p/306485#M23803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can only guess it wants you to pass them as parameters before the list rather than as magic numbers e.g&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;buff_dist1 = 100&lt;/P&gt;&lt;P&gt;buff_dist2 = 200&lt;/P&gt;&lt;P&gt;buff_dist3 = 300&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;distanceList = [ buff_dist1' ....&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also be aware your "riverbuffer" + ".shp" needs to change name during the iteration to reflect the input distance. Currently it will just overwrite with the same name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"Riverbuffer_" + str(distance) + "_ft.shp"&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Mar 2020 11:03:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-how-do-i-use-a-list-loop-with-the-buffer/m-p/306485#M23803</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-03-01T11:03:49Z</dc:date>
    </item>
  </channel>
</rss>

