Layer properties
Summary
The Describe function returns the following properties for Layers. The Dataset property group is 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 the Feature Class property group, while a layer that references a raster dataset will have access to the Raster Dataset property group.
If the data element being described is a layer in a map or an in-memory layer, the
dataTypereturned 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
.lyrxor.lyrfile by inspecting theDescribeobject returned by thelayerproperty.
Properties
| Property | Explanation | Data Type |
|---|---|---|
|
dataElement (Read only) |
The |
Describe |
|
endTimeField (Read only) |
The end time field of the layer (if the layer is time-aware). |
String |
|
featureClass (Read only) |
The |
Describe |
|
FIDSet (Read only) |
|
Integer |
|
fieldInfo (Read only) |
The |
FieldInfo |
|
layer (Read only) |
The |
Describe |
|
nameString (Read only) |
The name of the layer. |
String |
|
startTimeField (Read only) |
The start time field of the layer (if the layer is time-aware). |
String |
|
table (Read only) |
The |
Describe |
|
TimeZone (Read only) |
The time zone referred to by the start and end time fields (if time is specified for the layer). |
String |
|
whereClause (Read only) |
The layer's definition query where clause. |
String |
Code sample
Layer properties example 1
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.management.MakeFeatureLayer(
"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)
Layer properties example 2
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")