Select to view content in your preferred language

CatalogPath for map Layer Different in Pro vs. Desktop

497
3
01-11-2024 05:22 AM
EvanMyers1
Frequent Contributor

In ArcMap Desktop, I have this code to find the geodatabase/sde of a layer in my map:

abPoly = 'wGISProd.WUD.Asbuilt_Polygons'
desc = arcpy.Describe(abPoly)
workspace = os.path.dirname(desc.catalogPath)
sde = arcpy.Describe(workspace)
if hasattr(sde, "datasetType") and sde.datasetType == 'FeatureDataset':
    workspace = os.path.dirname(workspace)
print(workspace)
W:\\GIS\\Database Connections\\GISdb_wGISProd.OSA.sde

 

However, in ArcGIS Pro, I use the same code but get different results:

abPoly = 'wGISProd.WUD.Asbuilt_Polygons'
desc = arcpy.Describe(abPoly)
workspace = os.path.dirname(desc.catalogPath)
sde = arcpy.Describe(workspace)
if hasattr(sde, "datasetType") and sde.datasetType == 'FeatureDataset':
    workspace = os.path.dirname(workspace)
print(workspace)
C:\Users\emyers\AppData\Local\Temp\ArcGISProTemp18060\452cb8e506fc2ab239912c037c1cb7fb.sde

 

How do I get the result in Desktop into Pro?

Thanks!

0 Kudos
3 Replies
BlakeTerhune
MVP Regular Contributor

I use Describe catalogPath and I'm able to build a path to a different feature class in that workspace. What isn't working?

0 Kudos
EvanMyers1
Frequent Contributor

Thanks for the reply.  I do not want the strange temp directory that ArcGIS Pro provides for a feature layer, I want the actual source where the data is referenced.  The main point is the script is not giving me the 'catalogPath' like it describes, I am not storing my features in a temp folder.

0 Kudos
BlakeTerhune
MVP Regular Contributor

I can't find the documentation, but I recall that ArcGIS Pro does not store the raw path to SDE connections like ArcMap did. The "strange temp directory" is the best you're going to get.

0 Kudos