Résumé
The Describe function returns the following properties for Layers. Dataset Properties are also supported, as well as the properties of the data type, the layer references. For example, a layer that references a feature class will have access to FeatureClass Properties, while a layer that references a raster dataset will have access to Raster Dataset Properties.
- If the data element being described is a layer in a map or an in-memory layer, the dataType returned gives information about the data source of the layer being described. Some examples of this are "MosaicLayer", "FeatureLayer", and "GroupLayer".
- You can get information about the layer contained by a .lyrx or .lyr file by inspecting the Describe object returned by the layer property.
Propriétés
Propriété | Explication | Type de données |
dataElement (Lecture seule) | The Describe object of the data source to which the layer refers. | Describe |
endTimeField (Lecture seule) | The end time field of the layer (if the layer is time-aware). | String |
featureClass (Lecture seule) | The Describe object of the feature class associated with the feature layer. | Describe |
FIDSet (Lecture seule) | arcpy.Describe will return a semicolon-delimited string of selected feature IDs (record numbers). arcpy.da.Describe will return a list of selected feature IDs. If a selection has not been applied to the layer, FIDSet will return a None; if a selection was applied to the layer, but it returned no records, FIDSet will return an empty list. | Integer |
fieldInfo (Lecture seule) | The FieldInfo object (property set) of the layer. | FieldInfo |
layer (Lecture seule) | The Describe object of the layer within a .lyr file. | Describe |
nameString (Lecture seule) | The name of the layer. | String |
startTimeField (Lecture seule) | The start time field of the layer (if the layer is time-aware). | String |
table (Lecture seule) | The Describe object of the table within a layer. | Describe |
TimeZone (Lecture seule) | The time zone referred to by the start and end time fields (if time is specified for the layer). | String |
whereClause (Lecture seule) | The layer's definition query where clause. | String |
Exemple de code
The following stand-alone script displays some layer properties from an in-memory feature layer.
import arcpy
# Create an in memory feature layer from a feature class.
#
arcpy.MakeFeatureLayer_management(
"C:/data/chesapeake.gdb/bayshed",
"mainlines_layer")
# Create a Describe object from the feature layer.
#
desc = arcpy.Describe("mainlines_layer")
# Print some properties of the feature layer, and its featureclass.
#
print("Name String: " + desc.nameString)
print("Where Clause: " + desc.whereClause)
print("Feature class type: " + desc.featureClass.featureType)
The following stand-alone script displays some layer properties from a .lyr file.
import arcpy
# Create a Describe object from a .lyr file.
#
desc = arcpy.Describe("c:/data/water_pipes.lyr")
# Print some properties of the feature layer
#
print("Name String: " + desc.nameString)
print("Where Clause: " + desc.whereClause)
# Find out if the layer represents a feature class
if desc.dataElement.dataType == "FeatureClass":
print("Feature class: " + desc.dataElement.catalogPath)
print("Feature class Type: " + desc.featureClass.featureType)
else:
print("Not a regular feature class")
Vous avez un commentaire à formuler concernant cette rubrique ?