How could I get information to know which tables used for each layer ?

1134
11
05-07-2023 06:29 PM
Labels (2)
spiderman90
Occasional Contributor

I would like to get information from each layer .

Each feature class read different data from different tables at my database .

How could I get  information  to know which tables used for each layer in ArcMap ?

0 Kudos
11 Replies
DavidPike
MVP Frequent Contributor

Double click on the layer in the table-of-contents (or right click -> properties) to open the layer properties window.

Then go to the 'Source' tab at the top.  There you can see the data source the layer is reading from 

https://desktop.arcgis.com/en/arcmap/latest/map/working-with-layers/repairing-broken-data-links.htm

If you need to see the sources for all layers in the MXD or across multiple MXDs you can use a simple python script https://community.esri.com/t5/python-questions/script-to-print-all-data-layer-names-and-sources/td-p...

 

0 Kudos
spiderman90
Occasional Contributor

Thanks for ur reply .

I have looked to data source and it show me the name of feature dataset and name feature class .

but feature class data collected  from different tables .

i would like to get the name of  tables that used to provide the data to this feature class .

How could I get the name of them for each feature class ?

0 Kudos
JeffHouser
Occasional Contributor

Hello SM90, I have not tried the following ArcPy Code.  I just did a quick search online and found the following:

Actual feature class names (as in the data source names).
https://gis.stackexchange.com/questions/423776/listing-all-feature-classes-from-an-arcgis-project-fi...

import arcpy
import os
import glob
import pandas as pd

# ArcPro = arpx
# ArcMap = mxd
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.dataSource)

I hope this helps,

-Jeff

0 Kudos
spiderman90
Occasional Contributor

Thanks for the code.I thik the idea here to get the name of layers but I am looking to find the table names that provide data for each layer ?how could I achieve it ?

0 Kudos
RhettZufelt
MVP Frequent Contributor

In the table of contents, you can also list by data source:

RhettZufelt_1-1683558556322.png

 

 

R_

0 Kudos
spiderman90
Occasional Contributor

It shows me only the feature dataset but I need to know the name of tables the provide data for each feature class or feature dataset ? How could I get table names ?

0 Kudos
RhettZufelt
MVP Frequent Contributor

Are you talking about joined/related tables?

Basically, in my example above, "Centerlines" is a table in the geodatabase.  It also has shape field holding the geometry so Arc can display it as a feature class when added.

So, the table "name" would be "Centerlines".  If you right-click on it and open attribute table you can view it.

R_

0 Kudos
DavidPike
MVP Frequent Contributor

Not if the layer name has been changed in the TOC.

0 Kudos
RhettZufelt
MVP Frequent Contributor

Or if you have an Alias set on it.  That is why I used Centerlines as example, not Urban Growth Area (that is alias, but, it IS the table alias).

Just trying to clarify what a table that provides data for a layer is.....

R_

0 Kudos