<?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: Convert features with the same code to a KML file in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78319#M6316</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, I see. At 10.1 the arcpy.da cursors were introduced, so the old cursor object should be used. I will post back a revised script.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 07 Feb 2018 12:37:15 GMT</pubDate>
    <dc:creator>XanderBakker</dc:creator>
    <dc:date>2018-02-07T12:37:15Z</dc:date>
    <item>
      <title>Convert features with the same code to a KML file</title>
      <link>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78313#M6310</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM&gt;branched from&amp;nbsp;&lt;A href="https://community.esri.com/thread/207867-how-to-automate-selection-and-kml-conversion"&gt;https://community.esri.com/thread/207867-how-to-automate-selection-and-kml-conversion&lt;/A&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;I need to do something similar but for areas.&lt;/P&gt;&lt;P&gt;However I have arcmap10.0 and I cannot get this script to work.&lt;/P&gt;&lt;P&gt;Could you please assist me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to select multiple attributes that have the same name in the AA_area field and export them as a Kmz.&amp;nbsp; I then need it to choose the next area and repeat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EG. Alexandia is in the attribute table 10 times under AA_area and I would like it to export all 10 polygons into one kmz (this is a shapefile in need to convert from).&amp;nbsp; I need to do this for all the different areas in the AA_area field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Feb 2018 09:13:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78313#M6310</guid>
      <dc:creator>DanutaHodgson</dc:creator>
      <dc:date>2018-02-07T09:13:21Z</dc:date>
    </item>
    <item>
      <title>Re: Convert features with the same code to a KML file</title>
      <link>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78314#M6311</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/57074"&gt;Danuta Hodgson&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What you will need to do is:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;On line 7 locate the path to your input shapefile like this:&lt;/LI&gt;&lt;/UL&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fc_in &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'C:\Folder\SubFolder\myShapeFileName.shp'&lt;/SPAN&gt;‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;On line 8 you will have to specify the field with the names. For each name a KMZ will be created:&lt;/LI&gt;&lt;/UL&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fld_trail &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'AA_area'&lt;/SPAN&gt;‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On line 9 you will need to specify the output folder location where the KMZ files will be stored:&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; out_folder &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'C:\Folder\SubFolder\ResultingKMZfolder'&lt;/SPAN&gt;‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since you are using a shapefile your where clause will be different. So change line 17 to this:&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"\"{0}\" = '{1}'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fld&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; trail_name&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is important that the indentation remains the same. Changing it will make the code invalid.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Feb 2018 11:32:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78314#M6311</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2018-02-07T11:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: Convert features with the same code to a KML file</title>
      <link>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78315#M6312</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for coming back to me.&lt;/P&gt;&lt;P&gt;I tried what you said, but absolutely nothing happened.&lt;/P&gt;&lt;P&gt;Please could you double check&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also should train name not be changed to AA_area?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;def main():&lt;BR /&gt;... import arcpy&lt;BR /&gt;... import os&lt;BR /&gt;... arcpy.env.overwriteOutput = True&lt;BR /&gt;... &lt;BR /&gt;... # settings: edit these&lt;BR /&gt;... fc_in = r'C:\Users\Danuta\Desktop\CSS 2016-17\TEST\Agri\Agri_EC_working_data.shp'&lt;BR /&gt;... fld_trail = 'AA_area'&lt;BR /&gt;... out_folder = r'C:\Users\Danuta\Desktop\CSS 2016-17\TEST'&lt;BR /&gt;... &lt;BR /&gt;... # create list of unique trail names&lt;BR /&gt;... lst_trails = list(set([r[0] for r in arcpy.da.SearchCursor(fc_in, (fld_trail))]))&lt;BR /&gt;... &lt;BR /&gt;... # loop through trails&lt;BR /&gt;... for AA_area in lst_trails:&lt;BR /&gt;... fld = arcpy.AddFieldDelimiters(fc_in, fld_trail)&lt;BR /&gt;... where ="\"{0}\" = '{1}'".format(fld, trail_name)&lt;BR /&gt;... arcpy.MakeFeatureLayer_management(fc_in, "lyr", where)&lt;BR /&gt;... kmz_file = os.path.join(out_folder, "{0}.kmz".format(trail_name))&lt;BR /&gt;... arcpy.LayerToKML_conversion("lyr", kmz_file)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Feb 2018 11:50:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78315#M6312</guid>
      <dc:creator>DanutaHodgson</dc:creator>
      <dc:date>2018-02-07T11:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: Convert features with the same code to a KML file</title>
      <link>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78316#M6313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm going to branch your question to a new thread. It would be better if I have access to (a subset) of the data you want to use. Can you attach the shapefile (zipped) to this thread?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Feb 2018 12:01:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78316#M6313</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2018-02-07T12:01:18Z</dc:date>
    </item>
    <item>
      <title>Re: Convert features with the same code to a KML file</title>
      <link>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78317#M6314</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I notice that you didn't copy the entire code. The part that starts the code was not included. You should copy and paste the entire code below:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;main&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; os
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;overwriteOutput &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;# settings: edit these&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; fc_in &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'C:\Users\Danuta\Desktop\CSS 2016-17\TEST\Agri\Agri_EC_working_data.shp'&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; fld_trail &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'AA_area'&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_folder &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'C:\Users\Danuta\Desktop\CSS 2016-17\TEST'&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;# create list of unique trail names&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_trails &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; list&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;set&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;r&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="keyword token"&gt;for&lt;/SPAN&gt; r &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SearchCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc_in&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fld_trail&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;# loop through trails&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; trail_name &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; lst_trails&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fld &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddFieldDelimiters&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc_in&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fld_trail&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"\"{0}\" = '{1}'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fld&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; trail_name&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeFeatureLayer_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc_in&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"lyr"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; where&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; kmz_file &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;out_folder&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"{0}.kmz"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;trail_name&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;LayerToKML_conversion&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"lyr"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; kmz_file&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; __name__ &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'__main__'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; main&lt;SPAN class="punctuation token"&gt;(&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;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 23:01:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78317#M6314</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-10T23:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: Convert features with the same code to a KML file</title>
      <link>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78318#M6315</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have copied the above text into python in arc and I got a runtime error.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using ArcGIS 10.0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; def main():&lt;BR /&gt;... import arcpy&lt;BR /&gt;... import os&lt;BR /&gt;... arcpy.env.overwriteOutput = True&lt;BR /&gt;... &lt;BR /&gt;... # settings: edit these&lt;BR /&gt;... fc_in = r'C:\Users\Danuta\Desktop\CSS 2016-17\TEST\Agri\Agri_EC_working_data.shp'&lt;BR /&gt;... fld_trail = 'AA_area'&lt;BR /&gt;... out_folder = r'C:\Users\Danuta\Desktop\CSS 2016-17\TEST'&lt;BR /&gt;... &lt;BR /&gt;... # create list of unique trail names&lt;BR /&gt;... lst_trails = list(set([r[0] for r in arcpy.da.SearchCursor(fc_in, (fld_trail))]))&lt;BR /&gt;... &lt;BR /&gt;... # loop through trails&lt;BR /&gt;... for trail_name in lst_trails:&lt;BR /&gt;... fld = arcpy.AddFieldDelimiters(fc_in, fld_trail)&lt;BR /&gt;... where ="\"{0}\" = '{1}'".format(fld, trail_name)&lt;BR /&gt;... arcpy.MakeFeatureLayer_management(fc_in, "lyr", where)&lt;BR /&gt;... kmz_file = os.path.join(out_folder, "{0}.kmz".format(trail_name))&lt;BR /&gt;... arcpy.LayerToKML_conversion("lyr", kmz_file)&lt;BR /&gt;... &lt;BR /&gt;... if __name__ == '__main__':&lt;BR /&gt;... main()&lt;BR /&gt;... &lt;BR /&gt;Runtime error &amp;lt;type 'exceptions.AttributeError'&amp;gt;: 'module' object has no attribute 'da'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Feb 2018 12:34:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78318#M6315</guid>
      <dc:creator>DanutaHodgson</dc:creator>
      <dc:date>2018-02-07T12:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: Convert features with the same code to a KML file</title>
      <link>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78319#M6316</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, I see. At 10.1 the arcpy.da cursors were introduced, so the old cursor object should be used. I will post back a revised script.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Feb 2018 12:37:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78319#M6316</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2018-02-07T12:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: Convert features with the same code to a KML file</title>
      <link>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78320#M6317</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;main&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; os
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;overwriteOutput &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;# settings: edit these&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; fc_in &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'C:\Users\Danuta\Desktop\CSS 2016-17\TEST\Agri\Agri_EC_working_data.shp'&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; fld_trail &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'AA_area'&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_folder &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'C:\Users\Danuta\Desktop\CSS 2016-17\TEST'&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;# create list of unique trail names&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_trails &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SearchCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc_in&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_trails&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;append&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getValue&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fld_trail&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;del&lt;/SPAN&gt; cursor
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;del&lt;/SPAN&gt; row
&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_trails &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; list&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;set&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lst_trails&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;# loop through trails&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; trail_name &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; lst_trails&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fld &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddFieldDelimiters&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc_in&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fld_trail&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"\"{0}\" = '{1}'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fld&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; trail_name&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeFeatureLayer_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc_in&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"lyr"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; where&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; kmz_file &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;out_folder&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"{0}.kmz"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;trail_name&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;LayerToKML_conversion&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"lyr"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; kmz_file&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; __name__ &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'__main__'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; main&lt;SPAN class="punctuation token"&gt;(&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;/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>Fri, 10 Dec 2021 23:01:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78320#M6317</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-10T23:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: Convert features with the same code to a KML file</title>
      <link>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78321#M6318</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, thank you for helping me out.&amp;nbsp; I really suck at scripts.&lt;/P&gt;&lt;P&gt;I ran the script and and and ArcMap Drawing Error saying one or more layers failed to draw:&lt;/P&gt;&lt;P&gt;lyr: An invalid SQL&amp;nbsp;statement was used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Runtime error &amp;lt;class 'arcgisscripting.ExecuteError'&amp;gt;: ERROR 000622: Failed to execute (Layer To KML). Parameters are not valid. ERROR 000625: layer_output_scale parameter has no default value.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Should there be changes in the script. Could you tell me what and I can change them?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Really appreciate the help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Feb 2018 14:10:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78321#M6318</guid>
      <dc:creator>DanutaHodgson</dc:creator>
      <dc:date>2018-02-07T14:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: Convert features with the same code to a KML file</title>
      <link>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78322#M6319</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Possibly, something related to the data is happening here. To avoid guessing, I really would need to have a look at the data. Can you share it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Feb 2018 14:16:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78322#M6319</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2018-02-07T14:16:54Z</dc:date>
    </item>
    <item>
      <title>Re: Convert features with the same code to a KML file</title>
      <link>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78323#M6320</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sure&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Feb 2018 14:25:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78323#M6320</guid>
      <dc:creator>DanutaHodgson</dc:creator>
      <dc:date>2018-02-07T14:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: Convert features with the same code to a KML file</title>
      <link>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78324#M6321</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just did a test run and it returned an error on the where clause and I noticed that I already had accounted for different types of input featureclasses. So the original where clause is the correct one:&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"{0} = '{1}'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fld&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; trail_name&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It will generate 48 KMZ files:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/396026_pastedImage_1.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;If for some reason the problems persist, I can upload the generated KMZ files.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Feb 2018 14:43:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78324#M6321</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2018-02-07T14:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: Convert features with the same code to a KML file</title>
      <link>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78325#M6322</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you post the script again please.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much for your help &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Feb 2018 14:52:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78325#M6322</guid>
      <dc:creator>DanutaHodgson</dc:creator>
      <dc:date>2018-02-07T14:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: Convert features with the same code to a KML file</title>
      <link>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78326#M6323</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sure:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;main&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; os
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;overwriteOutput &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;# settings: edit these&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; fc_in &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'C:\Users\Danuta\Desktop\CSS 2016-17\TEST\Agri\Agri_EC_working_data.shp'&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; fld_trail &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'AA_area'&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; out_folder &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'C:\Users\Danuta\Desktop\CSS 2016-17\TEST'&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;##&amp;nbsp;&amp;nbsp;&amp;nbsp; fc_in = r'C:\GeoNet\ExportKMZ\Agri_EC_working_data.shp'&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;##&amp;nbsp;&amp;nbsp;&amp;nbsp; fld_trail = 'AA_area'&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;##&amp;nbsp;&amp;nbsp;&amp;nbsp; out_folder = r'C:\GeoNet\ExportKMZ\KMZ'&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;# create list of unique trail names&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_trails &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SearchCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc_in&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_trails&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;append&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getValue&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fld_trail&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;del&lt;/SPAN&gt; cursor
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;del&lt;/SPAN&gt; row
&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_trails &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; list&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;set&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lst_trails&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;# loop through trails&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; trail_name &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; lst_trails&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fld &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddFieldDelimiters&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc_in&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fld_trail&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"{0} = '{1}'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fld&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; trail_name&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; where
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeFeatureLayer_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc_in&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"lyr"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; where&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; kmz_file &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;out_folder&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"{0}.kmz"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;trail_name&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; kmz_file
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;LayerToKML_conversion&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"lyr"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; kmz_file&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; __name__ &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'__main__'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; main&lt;SPAN class="punctuation token"&gt;(&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;/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;P&gt;&lt;/P&gt;&lt;P&gt;... and I have attached the resulting KMZ files too.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 23:01:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78326#M6323</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-10T23:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: Convert features with the same code to a KML file</title>
      <link>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78327#M6324</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/people/danusha16@gmail.com"&gt;danusha16@gmail.com&lt;/A&gt;&amp;nbsp;, did the code work for you?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Feb 2018 18:05:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78327#M6324</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2018-02-07T18:05:21Z</dc:date>
    </item>
    <item>
      <title>Re: Convert features with the same code to a KML file</title>
      <link>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78328#M6325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Morning,&lt;/P&gt;&lt;P&gt;Thanks for the help.&lt;/P&gt;&lt;P&gt;I ran the code, just copy and pasted.&lt;/P&gt;&lt;P&gt;Still got an error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Runtime error &amp;lt;class 'arcgisscripting.ExecuteError'&amp;gt;: ERROR 000622: Failed to execute (Layer To KML). Parameters are not valid. ERROR 000625: layer_output_scale parameter has no default value. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for sending the kmz. The reason I need it to work is that I need to do this quite often with different files&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Danuta&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Feb 2018 05:57:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78328#M6325</guid>
      <dc:creator>DanutaHodgson</dc:creator>
      <dc:date>2018-02-08T05:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: Convert features with the same code to a KML file</title>
      <link>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78329#M6326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/57074"&gt;Danuta Hodgson&lt;/A&gt;&amp;nbsp;, I assume you can't update to a newer version of ArcGIS, right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since the code works on my computer using 10,6, there may have been a change in the&amp;nbsp;arrangement of the parameters over versions. What I would like you to do, is to manually&amp;nbsp;set a definition query, like this:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/396088_pastedImage_2.png" style="width: 620px; height: 322px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Go to your ArcToolbox and locate the Layer To KML tool and open it.&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/396101_pastedImage_3.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select the layer you want to export, define the output file, leave all the other&amp;nbsp;settings untouched and hit "OK":&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-3 jive-image" src="https://community.esri.com/legacyfs/online/396102_pastedImage_4.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After the tool has successfully&amp;nbsp;finished the process, open the Results window:&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-4" src="https://community.esri.com/legacyfs/online/396103_pastedImage_5.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;In the Results windows find the process you just executed, right click on it and copy the python snippet:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-5 jive-image" src="https://community.esri.com/legacyfs/online/396104_pastedImage_6.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my case it looks something like this:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# Replace a layer/table view name with a path to a dataset (which can be a layer file) or create the layer/table view within the script&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;# The following inputs are layers or table views: "Agri_EC_working_data", "test_pol"&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcpy.LayerToKML_conversion(layer="Agri_EC_working_data", out_kmz_file="C:/GeoNet/ExportKMZ/Alexandria.kmz", layer_output_scale="0", is_composite="NO_COMPOSITE", boundary_box_extent="test_pol", image_size="1024", dpi_of_client="96", ignore_zvalue="CLAMPED_TO_GROUND")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you copy this in the thread, so I can see if there is something different with the definition of the parameters? If so, I can adapt the code correspondingly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not, then you should try again&amp;nbsp;in a new session of ArcMap&amp;nbsp;without any environment settings set to see if that works. If not, then there will be little I can do, then to urge you to upgrade, since 10.0 is no longer supported.(it was retired on Jan 1, 2016 see&amp;nbsp;&lt;A class="link-titled" href="https://support.esri.com/en/Products/Desktop/arcgis-desktop/arcmap/10#product-support" title="https://support.esri.com/en/Products/Desktop/arcgis-desktop/arcmap/10#product-support"&gt;Esri Support 10.0&lt;/A&gt;&amp;nbsp;)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Feb 2018 11:57:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78329#M6326</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2018-02-08T11:57:41Z</dc:date>
    </item>
    <item>
      <title>Re: Convert features with the same code to a KML file</title>
      <link>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78330#M6327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to use this script to do a similar task and I am creating KMZs that have ALL files in the original feature class, even though I have the where clause in my script.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a KMZ for each individual landowner on a set of properties, some landowners having multiple properties. Any suggestions?&lt;BR /&gt;&lt;BR /&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2018 20:11:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-features-with-the-same-code-to-a-kml-file/m-p/78330#M6327</guid>
      <dc:creator>mapdonalds</dc:creator>
      <dc:date>2018-08-14T20:11:46Z</dc:date>
    </item>
  </channel>
</rss>

