Skip to main content
Question

How to extract layer names and each tables name related to each layer from mxd file


gogopotter90
Contributor
Forum|alt.badge.img+13

I have mxd file and I would like to extract layer names and each table names related to each layer

FME 2021

Thanks in advance

3 replies

hkingsbury
Celebrity
Forum|alt.badge.img+54
  • Celebrity
  • May 6, 2023

You'd have to use python, see below for a pseudo implementation (taken from - https://gis.stackexchange.com/questions/150734/listing-data-sources-in-arcgis-map-mxd-without-opening-it)

mxd = arcpy.mapping.MapDocument(m)
                for lyr in arcpy.mapping.ListLayers(mxd):
                        for dirpath, dirnames, filenames in arcpy.da.Walk(MapList):
                            for filename in filenames:
                                desc = arcpy.Describe(os.path.join(dirpath, filename))
                                desc.catalogPath
                                desc.name
                                desc.dataType

 


gogopotter90
Contributor
Forum|alt.badge.img+13
  • Author
  • Contributor
  • May 8, 2023
hkingsbury wrote:

You'd have to use python, see below for a pseudo implementation (taken from - https://gis.stackexchange.com/questions/150734/listing-data-sources-in-arcgis-map-mxd-without-opening-it)

mxd = arcpy.mapping.MapDocument(m)
                for lyr in arcpy.mapping.ListLayers(mxd):
                        for dirpath, dirnames, filenames in arcpy.da.Walk(MapList):
                            for filename in filenames:
                                desc = arcpy.Describe(os.path.join(dirpath, filename))
                                desc.catalogPath
                                desc.name
                                desc.dataType

 

Thanks for ur code ,

i have tried it and added in Python caller  the import modules and mxd path and csv path output but I got an error .it does not work with me .

 


hkingsbury
Celebrity
Forum|alt.badge.img+54
  • Celebrity
  • May 8, 2023
gogopotter90 wrote:

Thanks for ur code ,

i have tried it and added in Python caller the import modules and mxd path and csv path output but I got an error .it does not work with me .

 

As I said, the above is pseudo code. It's a rough outline of what is needed.

 

If you're getting an error, its helpful to include what that is otherwise we have no idea whats gone wrong 🙂


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings