0

I am trying to obtain a list of feature classes in an ArcGIS Project file from the data source (not the Map file layer name). I get the code below but this gives me the layer names in the APRX. I need the actual feature class names (as in the data source names).

import arcpy
import os
import glob
import pandas as pd

aprx_dir =  r'H:\007_Services-GV\02_GV_Updates\2201xx_Engineering\*.aprx'

aprx_dict = {}

for aprx_file in glob.glob(aprx_dir):
    aprx = arcpy.mp.ArcGISProject(aprx_file)
    for m in aprx.listMaps():
        print (aprx_file)
        for layer in m.listLayers():
            print (layer)

1 Answer 1

1

Replace print(layer) with print(layer.dataSource)

1
  • 1
    That works. Thank you so much. Commented Feb 15, 2022 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.