ListSpatialReferences
Resumen
The ListSpatialReferences function lists available spatial reference names for use as an argument to the SpatialReference class.
Sintaxis
ListSpatialReferences({wild_card}, {spatial_reference_type})
| El parámetro | Explicación | Tipo de datos |
|---|---|---|
|
wild_card |
Limits the results returned. If a value is not specified, all values are returned. The wildcard is not case sensitive. Use an asterisk (*) to represent zero or more characters. For example, |
String |
|
spatial_reference_type |
Specifies the spatial reference types that will be listed.
|
String |
Valor de retorno
| Tipo de datos | Explicación |
|---|---|
|
String |
A list of spatial references that match the wildcard and spatial reference type. Each item in the list includes qualifying information, separated with forward slashes, to help you limit your search or better understand the purpose of the spatial reference. For example, Another example is |
Muestra de código
List all geographic spatial references.
import arcpy
# Get the list of spatial references and print it.
srs = arcpy.ListSpatialReferences(spatial_reference_type="GCS")
for sr_name in srs:
print(sr_name)
Print the central meridians and names of UTM zones in New Zealand.
import arcpy
# Get the list of spatial references
srs = arcpy.ListSpatialReferences("*utm/new zealand*")
# Create a SpatialReference object for each one and print the
# central meridian
for sr_string in srs:
sr_object = arcpy.SpatialReference(sr_string)
print("{0.centralMeridian} {0.name}".format(sr_object))