<?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: Listing feature classes that are in use by an mxd in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/listing-feature-classes-that-are-in-use-by-an-mxd/m-p/559532#M43741</link>
    <description>&lt;P&gt;&lt;SPAN&gt;You should be able to run this script from idle.&amp;nbsp; Just substitute the path to your mxd.&amp;nbsp; You might have to tweak this some if the mxd has multiple data frames or grouped layers&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcpy import mapping
mapDoc = r'enter mxd file path here' 
mxd = mapping.MapDocument(mapDoc)
lyrs = mapping.ListLayers(mxd) 
lyrTitle = 'Map Layer' 
sourceTitle = 'Data Source' 
print('%-60s%s' % (lyrTitle,sourceTitle)) 
print('%-60s%s' % ('-' * len(lyrTitle), '-' * len(sourceTitle))) 
for lyr in lyrs:     
    try:         
        print('%-60s%s' % (lyr.name,lyr.dataSource))     
    except:         
        print('Unable to retrieve layer information')
del mxd&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 04 Oct 2024 14:10:09 GMT</pubDate>
    <dc:creator>BruceBacia</dc:creator>
    <dc:date>2024-10-04T14:10:09Z</dc:date>
    <item>
      <title>Listing feature classes that are in use by an mxd</title>
      <link>https://community.esri.com/t5/python-questions/listing-feature-classes-that-are-in-use-by-an-mxd/m-p/559531#M43740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to get a list of all feature classes that are in use by an mxd using a python script. I can access the map document through arcpy.mapping and list all of the layers, but I am having a difficult time listing the feature classes that are being used. The layer names within the map document have been changed from the original feature class, so listlayers does not give me an accurate description of the actual feature classes in use. If anyone has an idea of how to do this through a script it would be greatly appreciated. It is a simple script, where I want to create a list of feature classes in use by the mxd and copy them out to an xls file, but this one little thing is holding me up.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jesse&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Nov 2012 13:51:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listing-feature-classes-that-are-in-use-by-an-mxd/m-p/559531#M43740</guid>
      <dc:creator>JesseMorkis</dc:creator>
      <dc:date>2012-11-05T13:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: Listing feature classes that are in use by an mxd</title>
      <link>https://community.esri.com/t5/python-questions/listing-feature-classes-that-are-in-use-by-an-mxd/m-p/559532#M43741</link>
      <description>&lt;P&gt;&lt;SPAN&gt;You should be able to run this script from idle.&amp;nbsp; Just substitute the path to your mxd.&amp;nbsp; You might have to tweak this some if the mxd has multiple data frames or grouped layers&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcpy import mapping
mapDoc = r'enter mxd file path here' 
mxd = mapping.MapDocument(mapDoc)
lyrs = mapping.ListLayers(mxd) 
lyrTitle = 'Map Layer' 
sourceTitle = 'Data Source' 
print('%-60s%s' % (lyrTitle,sourceTitle)) 
print('%-60s%s' % ('-' * len(lyrTitle), '-' * len(sourceTitle))) 
for lyr in lyrs:     
    try:         
        print('%-60s%s' % (lyr.name,lyr.dataSource))     
    except:         
        print('Unable to retrieve layer information')
del mxd&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 04 Oct 2024 14:10:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listing-feature-classes-that-are-in-use-by-an-mxd/m-p/559532#M43741</guid>
      <dc:creator>BruceBacia</dc:creator>
      <dc:date>2024-10-04T14:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: Listing feature classes that are in use by an mxd</title>
      <link>https://community.esri.com/t5/python-questions/listing-feature-classes-that-are-in-use-by-an-mxd/m-p/559533#M43742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Bruce, that was exactly what I needed.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Nov 2012 17:33:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/listing-feature-classes-that-are-in-use-by-an-mxd/m-p/559533#M43742</guid>
      <dc:creator>JesseMorkis</dc:creator>
      <dc:date>2012-11-05T17:33:30Z</dc:date>
    </item>
  </channel>
</rss>

