Does anyone know how to find the path to a feature class within a label expression using ArcGIS?
I don’t need to simply display the path. My overall goal is to create a python function to display x,y coordinates directly from the Shape geometry, as shown in this answer. But this code will fail if the user changes the layer name, so I want to make the code more robust by finding the path to the feature class.
I know it is possible to find the path from the selected layer from the code below. But this will of course display varying paths depending on what layer is selected.
import pythonaddinsdef FindLabel ( [OBJECTID] ): mxd = arcpy.mapping.MapDocument("CURRENT") df = pythonaddins.GetSelectedTOCLayerOrDataFrame() return df.dataSourceI need something similar to __file__ for arcpy/ArcGIS with reference to the dataset. Does such a thing exists or is there another solution I can use?
أكثر...
I don’t need to simply display the path. My overall goal is to create a python function to display x,y coordinates directly from the Shape geometry, as shown in this answer. But this code will fail if the user changes the layer name, so I want to make the code more robust by finding the path to the feature class.
I know it is possible to find the path from the selected layer from the code below. But this will of course display varying paths depending on what layer is selected.
import pythonaddinsdef FindLabel ( [OBJECTID] ): mxd = arcpy.mapping.MapDocument("CURRENT") df = pythonaddins.GetSelectedTOCLayerOrDataFrame() return df.dataSourceI need something similar to __file__ for arcpy/ArcGIS with reference to the dataset. Does such a thing exists or is there another solution I can use?
أكثر...