Skip to main content

坐标系

常用地理坐标系

  • Geographic Coordinate Systems/World/WGS 1984

  • Geographic Coordinate Systems/Asia/China Geodetic Coordinate System 2000

  • Geographic Coordinate Systems/Asia/Xian 1980

  • Geographic Coordinate Systems/Asia/Beijing 1954

listCoordinateSystem = arcpy.ListSpatialReferences('*xxxx*',"PCS")

常用投影坐标

  • Systems/Gauss Kruger/Xian 1980/Xian 1980 3 Degree GK CM 102E
  • Systems/Gauss Kruger/Xian 1980/Xian 1980 3 Degree GK Zone 25
  • Kruger/Beijing 1954/Beijing 1954 3 Degree GK CM 102E
  • Kruger/Beijing 1954/Beijing 1954 GK Zone 13
  • Kruger/CGCS2000/CGCS2000 3 Degree GK CM 102E
  • Kruger/CGCS2000/CGCS2000 3 Degree GK Zone 25
listCoordinateSystem = arcpy.ListSpatialReferences('*xxxx*',"GCS")

API

  • ListSpatialReferences ({wild_card}, {spatial_reference_type}) - 列出本地gis支持的所有坐标系
  • SpatialReference(str) - 设置一个坐标系对象
    • str - 可以直接给出坐标系名称:"Kruger/CGCS2000/CGCS2000 3 Degree GK CM 111E"
    • str - 可以是.prj文件路径:"c:/projections/North America Equidistant Conic.prj"
  • ListTransformations - 转换坐标系

代码实例

  • 列出所有2000坐标的地理坐标系
listCoordinateSystem = arcpy.ListSpatialReferences('*2000*',"GCS")
print(len(listCoordinateSystem))
  • 列出所有2000坐标的投影坐标系 CGCS2000
listCoordinateSystem = arcpy.ListSpatialReferences('*CGCS2000*',"PCS")
print(len(listCoordinateSystem))
  • 指定坐标系获取xy,地理转换投影坐标
# 假设文件当前是 地理坐标 China Geodetic Coordinate System 2000
# 要转换的坐标系
coordinate = arcpy.SpatialReference("Kruger/CGCS2000/CGCS2000 3 Degree GK CM 111E")
shp = r'xxxx.shp'
with arcpy.da.SearchCursor(point,["SHAPE@X", "SHAPE@Y"], spatial_reference=coordinate) as cursors:
for each in cursors:
# 查询某个字段
print(each)
  • 使用 ListTransformations 确定可用于从一个坐标系投影到另一个坐标系的有效变换。
import arcpy

from_sr = arcpy.SpatialReference('WGS 1984')
to_sr = arcpy.SpatialReference('NAD 1927 StatePlane California VI FIPS 0406')

extent = arcpy.Extent(-178.217598182, 18.9217863640001,
-66.969270909, 71.4062354550001)
transformations = arcpy.ListTransformations(from_sr, to_sr, extent)