AnsweredAssumed Answered

List the sources of each of the "map layer"

Question asked by pierre.weisse on Sep 15, 2014
Latest reply on Sep 15, 2014 by Dan_Patterson

Hello,

 

I try to get the source of each "map layer".

Does anyone have an idea?

 

 

I need a syntax like this:
map layer: ... , source: ...
map layer: ... , source ...

 

 

 

This is the beginning of code

 

 

 

 

import arcpy, os

 

path = "....."

 

 

for fileName in os.listdir (path):

        fullPath = os.path.join (path, fileName)

        if os.path.isfile (fullPath):

            basename, extension = os.path.splitext (fullPath)

            lyrname = arcpy.mapping.Layer (fullPath)

                lyrlist = arcpy.mapping.ListLayers(lyrname)

                print "Nom du Fichier:   "

                print fileName

                print""

                print "Nom de la couche :  "

                print lyrname

                print""

                print "Couches contenu:   "

                print lyrlist

                print""

 

 

 

RESULT:

 

Nom du Fichier:  

DTSI_aires_protegees_provinciales.lyr

 

Nom de la couche : 

aires_protegees_provinciales

 

Couches contenu:  

[<map group layer u'aires_protegees_provinciales'>, <map layer u'Aires prot\xe9g\xe9es provinciales marines'>, <map layer u'Aires prot\xe9g\xe9es provinciales terrestres'>]

 

Thank you

Outcomes