Question

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


Badge +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

Userlevel 5
Badge +29

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

 

Badge +13

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 .

 

Userlevel 5
Badge +29

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 🙂

Reply