ListSpatialReferences (arcpy)

摘要

返回可用空间参考名称的 Python 列表,用作 arcpy.SpatialReference 的参数。

语法

ListSpatialReferences ({wild_card}, {spatial_reference_type})
参数说明数据类型
wild_card

Limit the spatial references listed by a simple wildcard check. The check is not case sensitive.

For example, arcpy.ListSpatialReferences("*Eckert*") would list Eckert I, Eckert II, and so forth.

String
spatial_reference_type

Limit the spatial references listed by type.

  • GCSList only Geographic Coordinate Systems.
  • PCSList only Projected Coordinate Systems.
  • ALLList both Projected and Geographic Coordinate Systems. This is the default.

(默认值为 All)

String
返回值
数据类型说明
String

与通配符和空间参考类型匹配的空间参考的 Python 列表。列表中的每项都包含采用正斜线进行分隔的限定信息,有助于您限定搜索范围或更好地了解空间参考的用途。

例如,列表中可能包含 u'Projected Coordinate Systems/World/Sinusoidal (world)'。从路径可以看出该空间参考属于投影坐标系,是一条正交曲线、旨在用于全局范围。

另一示例:u'Projected Coordinate Systems/UTM/South America/Corrego Alegre UTM Zone 25S'。这是一个针对南美洲 UTM 带的 UTM 空间参考。

代码实例

ListSpatialReferences 示例 1

列出所有地理空间参考。

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
ListSpatialReferences 示例 2

输出新西兰 UTM 带的中央经线和名称。

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)

相关主题

9/15/2013