<?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: Adding all GIS Layers from a folder in Mapping Questions</title>
    <link>https://community.esri.com/t5/mapping-questions/adding-all-gis-layers-from-a-folder/m-p/350635#M3796</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: jscheirer&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.MakeFeatureLayer_management(fc, fc)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Oct 2011 22:59:29 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2011-10-06T22:59:29Z</dc:date>
    <item>
      <title>Adding all GIS Layers from a folder</title>
      <link>https://community.esri.com/t5/mapping-questions/adding-all-gis-layers-from-a-folder/m-p/350634#M3795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Anyone know how to create a looping statement that adds all the GIS layers from a folder?&amp;nbsp; Using arcpy.mapping.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is what I got:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.workspace = '#whatever the folder is'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd = arcpy.mapping.MapDocument("Current")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fclist = arcpy.ListFeatureClasses()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for fc in fclist:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .....#something to add to your feature classes&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Oct 2011 15:17:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/adding-all-gis-layers-from-a-folder/m-p/350634#M3795</guid>
      <dc:creator>Ryan_Galbraith</dc:creator>
      <dc:date>2011-10-06T15:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: Adding all GIS Layers from a folder</title>
      <link>https://community.esri.com/t5/mapping-questions/adding-all-gis-layers-from-a-folder/m-p/350635#M3796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: jscheirer&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.MakeFeatureLayer_management(fc, fc)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Oct 2011 22:59:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/adding-all-gis-layers-from-a-folder/m-p/350635#M3796</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2011-10-06T22:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: Adding all GIS Layers from a folder</title>
      <link>https://community.esri.com/t5/mapping-questions/adding-all-gis-layers-from-a-folder/m-p/350636#M3797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You are on the right track.&amp;nbsp; Check out the samples for MakeFeatureLayer.&amp;nbsp; Also check out arcpy.mapping.AddLayer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Oct 2011 13:35:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/adding-all-gis-layers-from-a-folder/m-p/350636#M3797</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2011-10-07T13:35:28Z</dc:date>
    </item>
    <item>
      <title>Re: Adding all GIS Layers from a folder</title>
      <link>https://community.esri.com/t5/mapping-questions/adding-all-gis-layers-from-a-folder/m-p/350637#M3798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: rdg129&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;arcpy.MakeFeatureLayer_management(fc, fc)&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;No, that, didn't work, the two fcs can't be the same.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Oct 2011 14:04:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/adding-all-gis-layers-from-a-folder/m-p/350637#M3798</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2011-10-07T14:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: Adding all GIS Layers from a folder</title>
      <link>https://community.esri.com/t5/mapping-questions/adding-all-gis-layers-from-a-folder/m-p/350638#M3799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The second one is the name of the layer in the TOC. If that's not working, something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.env.workspace = '#whatever the folder is'
mxd = arcpy.mapping.MapDocument("Current")
fclist = arcpy.ListFeatureClasses()
for i, fc in enumerate(fclist):
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CreateFeatureLayer_management(fc, "layer_%i" % i)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:29:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/adding-all-gis-layers-from-a-folder/m-p/350638#M3799</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2021-12-11T16:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: Adding all GIS Layers from a folder</title>
      <link>https://community.esri.com/t5/mapping-questions/adding-all-gis-layers-from-a-folder/m-p/350639#M3800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: rdg129&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That doesn't work either.&amp;nbsp; Not sure why not it always brings up an error.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Oct 2011 14:41:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/adding-all-gis-layers-from-a-folder/m-p/350639#M3800</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2011-10-14T14:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: Adding all GIS Layers from a folder</title>
      <link>https://community.esri.com/t5/mapping-questions/adding-all-gis-layers-from-a-folder/m-p/350640#M3801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;That doesn't work either.&amp;nbsp; Not sure why not it always brings up an error.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Perhaps a dumb question, but what are you actually putting in the first line to specify the workspace folder?&amp;nbsp; If the path is unspecified or invalid (such as incorrect slashes, which is common with path strings), that could be the source of the error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
arcpy.env.workspace = 'C:\\GIS_DATA\\' # or r 'C:\GIS_DATA\'
mxd = arcpy.mapping.MapDocument("Current")
fclist = arcpy.ListFeatureClasses()
for i, fc in enumerate(fclist):
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CreateFeatureLayer_management(fc, "layer_%i" % i)
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:29:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/adding-all-gis-layers-from-a-folder/m-p/350640#M3801</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-11T16:29:23Z</dc:date>
    </item>
    <item>
      <title>Re: Adding all GIS Layers from a folder</title>
      <link>https://community.esri.com/t5/mapping-questions/adding-all-gis-layers-from-a-folder/m-p/350641#M3802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: rdg129&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family:Book Antiqua;"&gt;I am using shapefiles, does that matter?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2011 14:55:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/adding-all-gis-layers-from-a-folder/m-p/350641#M3802</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2011-10-19T14:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: Adding all GIS Layers from a folder</title>
      <link>https://community.esri.com/t5/mapping-questions/adding-all-gis-layers-from-a-folder/m-p/350642#M3803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;SPAN style="font-family:Book Antiqua;"&gt;I am using shapefiles, does that matter?&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think the problem is in the fact that the fc variable is a numeric value and not a feature class because it has been converted to an enumerated value.&amp;nbsp; The CreateFeatureLayer expects fc to be an actual feature class and not a number.&amp;nbsp; Separte the enumeration variable i from the fc variable.&amp;nbsp; Try the code below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
arcpy.env.workspace = 'C:\\GIS_DATA\\' # or r 'C:\GIS_DATA\'
mxd = arcpy.mapping.MapDocument("Current")
fclist = arcpy.ListFeatureClasses()
i = 0
for fc in fclist:
&amp;nbsp;&amp;nbsp;&amp;nbsp; i += 1
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CreateFeatureLayer_management(fc, "layer_%i" % i)
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:29:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/adding-all-gis-layers-from-a-folder/m-p/350642#M3803</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-11T16:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: Adding all GIS Layers from a folder</title>
      <link>https://community.esri.com/t5/mapping-questions/adding-all-gis-layers-from-a-folder/m-p/350643#M3804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: rdg129&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;GRRR.&amp;nbsp; Nothing is working.&amp;nbsp; thanks for all your help though.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Nov 2011 13:18:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/adding-all-gis-layers-from-a-folder/m-p/350643#M3804</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2011-11-17T13:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: Adding all GIS Layers from a folder</title>
      <link>https://community.esri.com/t5/mapping-questions/adding-all-gis-layers-from-a-folder/m-p/350644#M3805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Think this should work. I tested it on a folder of shp files.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
arcpy.env.workspace = "WORKSPACE"
mxd = arcpy.mapping.MapDocument('CURRENT')
fclist = arcpy.ListFeatureClasses()
for fc in fclist:
&amp;nbsp;&amp;nbsp;&amp;nbsp; name = fc.split(".") #Splits the .shp from the name
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(fc,name[0])
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:29:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/adding-all-gis-layers-from-a-folder/m-p/350644#M3805</guid>
      <dc:creator>BenjaminGale</dc:creator>
      <dc:date>2021-12-11T16:29:29Z</dc:date>
    </item>
  </channel>
</rss>

