GenerateOptimalCoordinateSystem

Краткая информация

Объект GenerateOptimalCoordinateSystem создает объект SpatialReference с пользовательской системой координат, оптимальной для определенного экстента и назначения карты или анализа.

Поскольку невозможно спроецировать изогнутую поверхность на плоскость без искажений, существуют различные картографические проекции, которые обеспечивают компромисс между сохранением формы, площади, расстояния или направления. Назначенная цель и экстент карты может помочь определить, какое из этих свойств необходимо сохранять. Например, равноугольная проекция может быть лучшим выбором для навигационной карты, чтобы сохранять направление курса, а проекцию, сохраняющую площади, можно использовать для визуализации или измерения относительного размера объектов.

Синтаксис

GenerateOptimalCoordinateSystem (extent, property, {custom_name})
ПараметрОписаниеТип данных
extent

The extent of interest. The Extent object must have a spatial reference in a geographic coordinate system such as WGS84.

Extent
property

Specifies the property that will be used to represent the purpose of the projection.

  • EQUAL_AREAThe relative area of regions everywhere on earth will be preserved. Shape and distances will be distorted.
  • CONFORMALAngles in small areas will be preserved, so shapes, for the most part, will be preserved. Size and distances will be distorted.
  • EQUIDISTANT_ONE_POINTDistance will be preserved when measured through the center of the projection. Area, shape, and other distances will be distorted.
  • EQUIDISTANT_MERIDIANSDistance will be preserved when measured along meridians. Area, shape, and other distances will be distorted.
  • COMPROMISE_WORLDArea, shape, and distance will not be specifically preserved, but a balance between these geometric properties will be created. Compromise projections are only suggested for very large areas.

Not all properties are supported for all extents of interest. The CONFORMAL and EQUIDISTANT_MERIDIANS properties are only supported for large-scale extents, and the COMPROMISE_WORLD property is only supported for full-world extents. The EQUAL_AREA and EQUIDISTANT_ONE_POINT properties are supported for all extents

String
custom_name

The name of the custom projected coordinate system. If no value is provided, the name will be Custom_Projection.

String
Возвращаемое значение
Тип данныхОписание
SpatialReference

Объект SpatialReference с пользовательской системой координат проекции, оптимальной для определенного экстента и назначенной цели.

Пример кода

GenerateOptimalCoordinateSystem, пример 1

Создает пользовательскую систему координат проекции, оптимизирующую сохранение формы в экстенте класса пространственных объектов, и проецирует класс объектов в пользовательскую систему координат.

import arcpy

# Input features in Projected Coordinate System
infc = r"C:\Projected.gdb\Colorado_Counties"

# Get extent of features
desc = arcpy.Describe(infc)
extent = desc.extent

# Project the extent to Geographic Coordinate System WGS84
gcs_sr = arcpy.SpatialReference(4326)
prj_extent = extent.projectAs(gcs_sr)

# Create custom projected coordinate system
custom_sr = arcpy.GenerateOptimalCoordinateSystem(prj_extent, "EQUAL_AREA",
                                                  "EQUAL_AREA_COLORADO")

# Project the input features to the custom projection
fc_prj = arcpy.management.Project(infc, "TestPoly_Projected", custom_sr)
GenerateOptimalCoordinateSystem, пример 2

Создает простой полигональный объект и проецирует его в пользовательскую систему координат с сохранением формы.

import arcpy

gcs_sr = arcpy.SpatialReference(4326) # Create WGS84 spatial reference

# Create polygon
poly_info = [[20, 20], [20, 60], [60, 60], [60, 20], [20, 20]]
poly_pts = arcpy.Array([arcpy.Point(*coords) for coords in poly_info])
poly = arcpy.Polygon(poly_pts, gcs_sr)

# Create extent object from polygon
extent = poly.extent

# Create custom projected coordinate system
custom_sr = arcpy.GenerateOptimalCoordinateSystem(extent, "CONFORMAL")

# Project the polygon to the custom projection
poly_prj = poly.projectAs(custom_sr)

Связанные разделы