Skip to main content

Geometry

汇总

几何对象用于定于空间位置和关联的几何形状。

讨论

在许多地理处理工作流中,您可能需要使用坐标和几何信息运行特定操作,但不一定想经历创建新(临时)要素类、使用光标填充要素类、使用要素类,然后删除临时要素类的过程。 可以使用几何对象替代输入和输出,从而使地理处理变得更简单。 使用 GeometryMultipointPointGeometryPolygonPolyline 类可以从头开始创建几何对象。

在创建几何对象的过程中,将执行一个简化过程,以使几何根据其几何类型在拓扑上保持一致。 例如,将校正可能自相交的面,或包含错误环方向的面。 坐标可能会在几何空间参考的分辨率范围内移动。

语法

Geometry(geometry, inputs, {spatial_reference}, {has_z}, {has_m}, {has_id})

名称 说明 数据类型

geometry

The geometry type.

  • point—The geometry is a point.

  • polygon—The geometry is a polygon.

  • polyline—The geometry is a polyline.

  • multipoint—The geometry is a multipoint.

String

inputs

The coordinate information used to create the object. The data type can be Point or Array objects.

Object

spatial_reference

(可选)

The spatial reference of the new geometry.

(默认值为 None)

SpatialReference

has_z

(可选)

Specifies whether the geometry will be z-enabled.

(默认值为 False)

Boolean

has_m

(可选)

Specifies whether the geometry will be m-enabled.

(默认值为 False)

Boolean

has_id

(可选)

Specifies whether the geometry will support point IDs.

(默认值为 False)

Boolean

属性

名称 说明 数据类型

JSON

(只读)

采用字符串形式的几何的 Esri JSON 制图表达。

提示:

通过 json 模块的 loads 函数,返回的字符串可转换至字典。

String

WKB

(只读)

OGC 几何的熟知二进制 (WKB) 表示。 该属性以连续字节流的形式提供几何值的可移植表示。

Bytearray

WKT

(只读)

OGC 几何的熟知文本 (WKT) 表示。 该属性以文本字符串的形式提供几何值的可移植表示。

几何中的所有真曲线都将在 WKT 字符串的近似曲线中进行增密。

String

area

(只读)

面要素的面积。 对于其他所有要素类型,面积为零。

Double

centroid

(只读)

如果质心位于要素之内或要素之上则为真;否则为标注点。

Point

extent

(读取和写入)

几何范围。

Extent

firstPoint

(只读)

几何的第一个坐标点。

Point

hasCurves

(只读)

指定几何是否具有曲线。

Boolean

hullRectangle

(只读)

凸包矩形坐标对的空格分隔字符串。

String

isMultipart

(只读)

指定几何的部分数是否大于 1。

Boolean

labelPoint

(只读)

标注位置所在的点。 该点始终位于要素之内或之上。

Point

lastPoint

(只读)

要素最后一个坐标。

Point

length

(只读)

线状要素的长度。 该计算将使用 2D 笛卡尔算法。

对于点和多点几何,长度为零。 对于面几何,长度将是边界的 2D 长度。

Double

length3D

(只读)

线状要素的 3D 长度。 该计算将使用 3D 笛卡尔算法。

对于点和多点几何,长度为零。 对于面几何,长度将是边界的 3D 长度。

注意:

该操作不执行水平和垂直坐标系之间的单位转换。 假设 x、y 和 z 坐标在同一线性单位中。

注意:

此属性仅适用于投影数据。

Double

partCount

(只读)

要素的几何部分数。

Integer

pointCount

(只读)

要素的总点数。

Integer

spatialReference

(只读)

几何的空间参考。

SpatialReference

trueCentroid

(只读)

要素的重心。

Point

type

(只读)

几何类型: polygonpolylinepointmultipoint

String

方法

angleAndDistanceTo(other, {method})

返回到点或面的角度和距离的元组。

名称 说明 数据类型

other

The second geometry. If the geometry is a polygon, the distance is measured to the centroid of the polygon.

PointGeometry

method

(可选)

Specifies the method that will be used to measure distance.

  • GEODESIC—The shortest line between any two points on the earth's surface on a spheroid (ellipsoid). One use for a geodesic line is to determine the shortest distance between two cities for an airplane's flight path. This is also known as a great circle line if based on a sphere rather than an ellipsoid.

  • GREAT_ELLIPTIC—The line on a spheroid (ellipsoid) defined by the intersection at the surface by a plane that passes through the center of the spheroid and the start and endpoints of a segment. This is also known as a great circle when a sphere is used.

  • LOXODROME—The line follows a single compass bearing, or azimuth. Great circle routes are often broken into a series of loxodromes, which simplifies navigation. This is also known as a rhumb line.

  • PLANAR—Planar measurements use 2D Cartesian mathematics to calculate lengths and areas. This option is only available when measuring in a projected coordinate system and the 2D plane of that coordinate system will be used as the basis for the measurements. Planar measurements reflect the projection of geographic data onto a 2D surface, and do not account for the curvature of the earth.

(默认值为 GEODESIC)

String

返回值

数据类型 说明

tuple

将一组角(以度为单位)和距离(以米为单位)返回到另一个点。

boundary()

构造几何边界。

边界运算符

返回值

数据类型 说明

Object

面的边界是折线。 折线的边界是多点,对应于线的端点。 点或多点的边界是空的点或多点。

buffer(distance)

在距几何的指定距离处构造一个面。

缓冲运算符

名称 说明 数据类型

distance

The buffer distance.

The buffer distance is in the same units as the geometry that is being buffered.

A negative distance can only be specified for a polygon geometry.

Double

返回值

数据类型 说明

Polygon

缓冲的面几何。

clip(envelope)

构造几何体与指定范围的交集。

裁剪运算符

名称 说明 数据类型

envelope

An Extent object used to define the clip extent.

Extent

返回值

数据类型 说明

Object

将输出几何体按指定范围进行裁剪。

contains(second_geometry, {relation})

指定基础几何是否包含比较几何。

contains 方法与 within 方法相反。

本图仅显示 True 关系。

可能的包含关系

名称 说明 数据类型

second_geometry

A second geometry.

Object

relation

(可选)

Specifies the spatial relationship type that will be used.

  • BOUNDARY—The relationship has no restrictions for interiors or boundaries.

  • CLEMENTINI— Interiors of geometries must intersect. This option is equivalent to specifying None. This is the default.

  • PROPER— Boundaries of geometries must not intersect.

(默认值为 None)

String

返回值

数据类型 说明

Boolean

返回此几何是否包含第二个几何。

convexHull()

构造具有最小边界多边形的几何,以便所有外角均为凸角。

凸包运算符

返回值

数据类型 说明

Object

生成的几何。 单个点的凸包为该点本身。

crosses(second_geometry)

指定两个几何是否相交于较小形状类型的几何。

如果两条折线仅共用公共点(至少有一个点不是端点),则这两条折线交叉。 如果折线和面在面的内部共享一条折线(不等于整条折线)或一个公共点(对于垂直线),那么该折线与面交叉。

本图仅显示 True 关系。

可能的交叉关系

名称 说明 数据类型

second_geometry

A second geometry.

Object

返回值

数据类型 说明

Boolean

返回两个几何是否相交于较小形状类型的几何。

cut(cutter)

将该几何分割到剪切折线的左右两侧。

剪切折线或面时,将在其与剪切折线相交的位置进行分割。 每一块都被分类为剪切线的左侧或右侧。 此分类基于剪切线的方向。 目标折线中不与剪切折线相交的部分将作为输入折线结果右侧的部分返回。 如果未对几何进行剪切,则左侧几何将为空 (None)。

剪切运算符

名称 说明 数据类型

cutter

The cutting polyline geometry.

PolyLine

返回值

数据类型 说明

Geometry

包含两个几何的列表。

densify(method, distance, {deviation})

使用添加的折点创建几何。

名称 说明 数据类型

method

The method of densification.

  • DISTANCE—Creates a feature that is a piecewise linear approximation of the input.

  • ANGLE—Creates a feature that is a piecewise linear approximation of the input. Vertices are introduced at points where the angle between tangents at those points is the provided angle.

  • GEODESIC—Densifies and reshapes segments between input vertices so that the output segments follow the shortest ground path connecting input vertices.

String

distance

The maximum distance between vertices. The actual distance between vertices will usually be less than the maximum distance, as new vertices will be evenly distributed along the original segment.

If using a type of DISTANCE or ANGLE, the distance is measured in the units of the geometry's spatial reference. If using a type of GEODESIC, the distance is measured in meters.

Double

deviation

(可选)

Densify uses straight lines to approximate curves. You use deviation to control the accuracy of this approximation. The deviation is the maximum distance between the new segment and the original curve. The smaller its value, the more segments will be required to approximate the curve.

If using a type of DISTANCE, the deviation is measured in the units of the geometry's spatial reference. If using a type of ANGLE, the deviation is measured in radians. If using a type of GEODESIC, the deviation is not used.

Double

返回值

数据类型 说明

Geometry

增密几何。

difference(other)

构造一个几何,该几何仅由基础几何所特有、而其他几何所没有的区域组成。

下图显示当红色多边形为源几何时的结果:

差异运算符

名称 说明 数据类型

other

A second geometry.

Object

返回值

数据类型 说明

Object

生成的几何。

disjoint(second_geometry)

指定基础几何和比较几何是否具有公共点。

此方法返回 False 时,两个几何相交。

本图仅显示 True 关系。

可能的不相交关系

名称 说明 数据类型

second_geometry

A second geometry.

Object

返回值

数据类型 说明

Boolean

返回两个几何是否具有公共点。

distanceTo(other)

返回两个几何之间的最小距离。距离将采用几何空间参考的单位。如果两个几何相交,则最小距离为 0。

两个几何必须具有相同的投影。

名称 说明 数据类型

other

第二个几何。

Object

返回值

数据类型 说明

Double

两个几何之间的距离。

equals(second_geometry)

指定基础几何和比较几何是否具有相同的形状类型,并在平面中定义相同的点集。 这仅是 2D 的比较;已忽略 m 值和 z 值。

本图仅显示 True 关系。

可能的相等关系

名称 说明 数据类型

second_geometry

A second geometry.

Object

返回值

数据类型 说明

Boolean

返回两种几何是否具有相同的形状类型,并在平面中定义相同的点集。

generalize(max_offset)

使用指定的最大偏移容差来创建一个简化几何。

名称 说明 数据类型

max_offset

The maximum offset tolerance.

Double

返回值

数据类型 说明

Geometry

概化的几何。

getArea({method}, {units})

使用测量方法返回要素的面积。

名称 说明 数据类型

method

(可选)

The method used to measure area.

  • GEODESIC—The shortest line between any two points on the earth's surface on a spheroid (ellipsoid). One use for a geodesic line is to determine the shortest distance between two cities for an airplane's flight path. This is also known as a great circle line if based on a sphere rather than an ellipsoid.

  • GREAT_ELLIPTIC—The line on a spheroid (ellipsoid) defined by the intersection at the surface by a plane that passes through the center of the spheroid and the start and endpoints of a segment. This is also known as a great circle when a sphere is used.

  • LOXODROME—The line follows a single compass bearing, or azimuth. Great circle routes are often broken into a series of loxodromes, which simplifies navigation. This is also known as a rhumb line.

  • PLANAR—Planar measurements use 2D Cartesian mathematics to calculate lengths and areas. This option is only available when measuring in a projected coordinate system and the 2D plane of that coordinate system will be used as the basis for the measurements. Planar measurements reflect the projection of geographic data onto a 2D surface, and do not account for the curvature of the earth.

  • PRESERVE_SHAPE—This type calculates the area or length of the geometry on the surface of the earth ellipsoid, for geometry defined in a projected or geographic coordinate system. This option preserves the shape of the geometry in its coordinate system.

(默认值为 GEODESIC)

String

units

(可选)

The units in which the area will be calculated.

Learn more about area units

  • SquareKilometers—Square kilometers

  • Hectares—Hectares

  • Ares—Ares

  • SquareMeters—Square meters

  • SquareDecimeters—Square decimeters

  • SquareCentimeters—Square centimeters

  • SquareMillimeters—Square millimeters

  • SquareMilesInt—Square statute miles

  • AcresInt—International acres

  • SquareYardsInt—Square international yards

  • SquareFeetInt—Square international feet

  • SquareInchesInt—Square international inches

  • SquareMilesUS—Square US survey miles

  • AcresUS—Square US survey acres

  • SquareYardsUS—Square US survey yards

  • SquareFeetUS—Square US survey feet

  • SquareInchesUS—Square US survey inches

  • Unknown—Unknown

String

返回值

数据类型 说明

Double

要素的面积。

默认情况下,在投影坐标系中,将采用坐标系的单位返回面积,在地理坐标系中,将以平方米为单位返回面积。

getLength({method}, {units})

使用测量方法返回要素的长度。

名称 说明 数据类型

method

(可选)

The method used to measure length.

  • GEODESIC—The shortest line between any two points on the earth's surface on a spheroid (ellipsoid). One use for a geodesic line is to determine the shortest distance between two cities for an airplane's flight path. This is also known as a great circle line if based on a sphere rather than an ellipsoid.

  • GREAT_ELLIPTIC—The line on a spheroid (ellipsoid) defined by the intersection at the surface by a plane that passes through the center of the spheroid and the start and endpoints of a segment. This is also known as a great circle when a sphere is used.

  • LOXODROME—The line follows a single compass bearing, or azimuth. Great circle routes are often broken into a series of loxodromes, which simplifies navigation. This is also known as a rhumb line.

  • PLANAR—Planar measurements use 2D Cartesian mathematics to calculate lengths and areas. This option is only available when measuring in a projected coordinate system and the 2D plane of that coordinate system will be used as the basis for the measurements. Planar measurements reflect the projection of geographic data onto a 2D surface, and do not account for the curvature of the earth.

  • PRESERVE_SHAPE—This type calculates the area or length of the geometry on the surface of the earth ellipsoid, for geometry defined in a projected or geographic coordinate system. This option preserves the shape of the geometry in its coordinate system.

(默认值为 GEODESIC)

String

units

(可选)

The units in which the length will be calculated.

Learn more about linear units

  • Kilometers—Kilometers

  • Meters—Meters

  • Decimeters—Decimeters

  • Millimeters—Millimeters

  • Centimeters—Centimeters

  • NauticalMilesInt—International nautical miles

  • MilesInt—Statute miles

  • YardsInt—International yards

  • FeetInt—International feet

  • InchesInt—International inches

  • NauticalMiles—US survey nautical miles

  • Miles—US survey miles

  • Yards—US survey yards

  • Feet—US survey feet

  • Inches—US survey inches

  • DecimalDegrees—Decimal degrees

  • Points—Points

  • Unknown—Unknown

String

返回值

数据类型 说明

Double

要素的长度。

默认情况下,在投影坐标系中,将采用坐标系的单位返回长度,在地理坐标系中,将以米为单位返回长度。

getPart({index})

如果指定了索引,则将返回几何特定部分的 Point 对象的 Array 对象。 如果未指定索引,则返回的 Array 对象将包含每个几何部分的 Point 对象的 Array

getPart 方法等同于建立对象索引;即 obj.getPart(0) 等同于 obj[0]

名称 说明 数据类型

index

(可选)

The index position of the geometry.

Integer

返回值

数据类型 说明

Array

生成的 Array 对象。

intersect(other, dimension)

构造一个几何,它是两个输入几何的几何交集。 不同的维数可用于创建不同的 shape 类型。

对于同一 shape 类型的两个几何体,其交集为仅包含原始几何重叠区域的几何。

相交运算符

为了更快地获取结果,请在调用 intersect 类之前先测试两个几何体是否 disjoint

名称 说明 数据类型

other

The second geometry.

Object

dimension

Specifies the topological dimension (shape type) of the resulting geometry.

  • 1—The geometry will be a zero-dimensional geometry (point or multipoint).

  • 2—The geometry will be a one-dimensional geometry (polyline).

  • 4—The geometry will be a two-dimensional geometry (polygon).

Integer

返回值

数据类型 说明

Object

作为两个输入几何体的交集的新几何体(点、多点、折线或面)。

measureOnLine(in_point, {use_percentage})

返回从此条线的起点到 in_point 之间的一个测量值。

名称 说明 数据类型

in_point

A point (PointGeometry or Point) that is used to measure from the start point of the polyline.

If the point does not intersect the line, the function will use the nearest location on the line from the point.

PointGeometry

use_percentage

(可选)

If False, the measure will be returned as a distance; if True, the measure will be returned as a percentage.

(默认值为 False)

Boolean

返回值

数据类型 说明

Double

距离或百分比值。

move({dx}, {dy}, {dz})

沿 x、y 和 z 轴将几何移动指定的距离以创建新几何。

名称 说明 数据类型

dx

(可选)

The distance the geometry will be moved along the x-axis.

(默认值为 0.0)

Double

dy

(可选)

The distance the geometry will be moved along the y-axis.

(默认值为 0.0)

Double

dz

(可选)

The distance the geometry will be moved along the z-axis. The geometry must be z-aware and have z-values.

(默认值为 0.0)

Double

返回值

数据类型 说明

Geometry

沿 x、y 和 z 轴按指定距离移动的输出几何。

overlaps(second_geometry)

指定两个几何的交集是否具有与其中一个输入几何相同的形状类型,并且不等于任一输入几何。

本图仅显示 True 关系。

可能的叠置关系

名称 说明 数据类型

second_geometry

A second geometry.

Object

返回值

数据类型 说明

Boolean

返回两个几何的交集是否具有与其中一个输入几何相同的尺寸。

pointFromAngleAndDistance(angle, distance, {method})

使用指定的测量类型按给定的角度(以度为单位)和距离(采用几何空间参考的单位)返回点。

名称 说明 数据类型

angle

The angle in degrees to the returned point.

Double

distance

The distance in the units of the geometry's spatial reference to the returned point.

Double

method

(可选)

Specifies the method that will be used to measure distance.

  • GEODESIC—The shortest line between any two points on the earth's surface on a spheroid (ellipsoid). One use for a geodesic line is to determine the shortest distance between two cities for an airplane's flight path. This is also known as a great circle line if based on a sphere rather than an ellipsoid.

  • GREAT_ELLIPTIC—The line on a spheroid (ellipsoid) defined by the intersection at the surface by a plane that passes through the center of the spheroid and the start and endpoints of a segment. This is also known as a great circle when a sphere is used.

  • LOXODROME—The line follows a single compass bearing, or azimuth. Great circle routes are often broken into a series of loxodromes, which simplifies navigation. This is also known as a rhumb line.

  • PLANAR—Planar measurements use 2D Cartesian mathematics to calculate lengths and areas. This option is only available when measuring in a projected coordinate system and the 2D plane of that coordinate system will be used as the basis for the measurements. Planar measurements reflect the projection of geographic data onto a 2D surface, and do not account for the curvature of the earth.

(默认值为 GEODESIC)

String

返回值

数据类型 说明

PointGeometry

按给定的角度(以度为单位)和距离(以米为单位)返回点。

positionAlongLine(value, {use_percentage}, {geodesic})

返回线上距线起点指定距离处的点。

名称 说明 数据类型

value

The distance along the line.

The distance will be evaluated based on the geodesic parameter value. If the geodesic parameter value is False, the distance will be evaluated in meters. If the geodesic parameter value is True, the distance will be evaluated in the units of the feature's spatial reference.

If the value exceeds the length of the line or precedes the length of the line (a negative value), the behaviour will depend on the geodesic parameter value as follows:

  • If the geodesic parameter value is False, exceeding the length of the line will return the endpoint of the line, and a negative distance value will return the starting point of the line.

  • If the geodesic parameter value is True, exceeding or preceding the length of the line will cause the method to fail.

Double

use_percentage

(可选)

Specifies whether the distance is specified as a fixed unit of measure (False) or a ratio of the length of the line (True).

For percentages, express the value parameter as a double from 0.0 (0 percent) to 1.0 (100 percent).

注:

This parameter is only supported when the geodesic parameter value is False.

(默认值为 False)

Boolean

geodesic

(可选)

Specifies whether the distance measure will be geodesic (True) or planar (False).

(默认值为 False)

Boolean

返回值

数据类型 说明

PointGeometry

线上距线起点指定距离的点。

projectAs(spatial_reference, {transformation_name})

将几何从一个空间参考投影到另一个空间参考。

当几何对象和目标空间参考没有公共基准面时,请指定 transformation_name 参数值。 有关详细信息,请参阅 地理基准面变换ListTransformations

当满足以下条件时,将执行垂直变换:

  • 几何对象具有 z 坐标。

  • 几何对象的空间参考和 spatial_reference 参数值均具有垂直坐标系。

  • transformation_name 参数值为垂直变换。

transformation_name 参数值是垂直变换,并且几何对象和目标空间参考都没有垂直坐标系时,函数将运算失败,并显示 ValueError 异常。

如果几何对象或 spatial_reference 参数值具有 未知空间参考 ,则输出几何的空间参考将是 spatial_reference 参数值的空间参考。 不建议使用未知空间参考进行分析。

projectAs 方法不会修改 m 值(如果存在)。

名称 说明 数据类型

spatial_reference

The spatial reference to which the geometry will be projected. The value can be a SpatialReference object or the coordinate system name.

SpatialReference

transformation_name

(可选)

The geotransformation name.

With ArcGIS Pro, if you do not specify a transformation, none will be applied. With ArcGIS Server, if you do not specify a transformation, a fallback transformation will be applied.

String

返回值

数据类型 说明

Object

经投影的几何。

queryPointAndDistance(in_point, {as_percentage})

在折线上找到离 in_point 最近的点,并确定这两点间的距离。 它同时返回关于点位于线的哪一侧以及最近点沿线的距离。

名称 说明 数据类型

in_point

The input point. Both PointGeometry and Point objects are accepted.

PointGeometry

as_percentage

(可选)

If False, the measure will be returned as a distance; if True, the measure will be returned as a percentage.

(默认值为 False)

Boolean

返回值

数据类型 说明

tuple

返回包含以下信息的一个元组:

  • PointGeometry 对象,折线上距 in_point 最近的点。

  • 线的起点和返回点之间的距离。

  • 线和 in_point 间的最小距离。

  • 指示 in_point 是否在线右侧的布尔值。 线的方向决定左右两侧。

距离将以几何空间参考的单位进行测量。

rotate({origin}, {rotation_angle})

将几何围绕指定原点旋转指定角度(以弧度表示)。

旋转相对于原点应用,以便几何围绕原点旋转。 原点的选择对于旋转几何的位置影响很大。

旋转不适用于 z 方向。

以下将介绍原点及其对输出的影响的一些可能的选择:

  • 原点位于几何外(不在几何内或接触几何)- 几何的位置将发生变化,但该几何与其他以相同方式旋转的几何的相对位置保持不变。 位置将围绕原点旋转。

    几何外的原点

  • 原点位于几何的质心(质心位于几何内部或接触几何)- 几何将围绕其质心旋转。

    几何质心处的原点

  • 原点位于几何的顶点 - 几何将围绕所选顶点旋转。

    几何顶点处的原点

名称 说明 数据类型

origin

(可选)

The origin of the transformation. The argument can be either an arcpy.Point object or an arcpy.PointGeometry object.

The default origin, arcpy.Point(0.0, 0.0), will usually be located outside the target geometry.

(默认值为 arcpy.Point(0.0, 0.0))

Point

rotation_angle

(可选)

The angle, in radians, to rotate the geometry around its origin.

The default rotation angle is 0.0 radians (no rotation).

(默认值为 0.0)

Float

返回值

数据类型 说明

Geometry

输入几何围绕指定原点旋转指定角度。

scale({origin}, {sx}, {sy}, {sz})

从指定的原点沿 x、y 和 z 轴按指定的因子缩放几何以创建新几何。 已变换点(或顶点)的位置由以下提供:

\(( \space (x \space - \space origin_x) \space * \space scale_x \space + \space origin_x, \space (y \space - \space origin_y) \space * \space scale_y \space + \space origin_y, \space (z \space - \space origin_z) \space * \space scale_z \space + \space origin_z \space )\)

相对于原点应用变换,以使原点保持静止,而几何围绕其扩展或收缩。 所生成几何的扩展或收缩位置和方向受到原点的显著影响。

以下将介绍原点及其对输出的影响的一些可能的选择:

  • 原点位于几何外(不在几何内或接触几何) - 几何的大小和位置将发生变化,但几何将保持与以相同方式缩放的其他几何的相对位置。 位置将远离原点扩展或向原点收缩。

    几何外的原点

  • 原点位于几何的质心(如果质心位于几何内部或接触几何)- 几何的大小将发生变化,但几何的位置将保持锚定在质心。 几何将围绕质心增大或收缩。

    几何质心处的原点

  • 原点位于几何的顶点 - 几何的大小将发生变化,但几何的位置将保持锚定在所选顶点。 几何将从所选顶点开始增长或向顶点收缩。

    几何顶点处的原点

名称 说明 数据类型

origin

(可选)

The origin of the transformation. The argument can be either an arcpy.Point object or an arcpy.PointGeometry object.

The default origin, arcpy.Point(0.0, 0.0, 0.0), will usually be located outside the target geometry.

(默认值为 arcpy.Point(0.0, 0.0, 0.0))

Point

sx

(可选)

The factor that will be used to scale the geometry along the x-axis.

(默认值为 1.0)

Double

sy

(可选)

The factor that will be used to scale the geometry along the y-axis.

(默认值为 1.0)

Double

sz

(可选)

The factor that will be used to scale the geometry along the z-axis. The geometry must be z-aware and have z-values.

(默认值为 1.0)

Double

返回值

数据类型 说明

Geometry

从指定原点沿 x、y 和 z 轴按指定因子缩放的输出几何。

segmentAlongLine(start_measure, end_measure, {use_percentage})

在起始测量值和结束测量值之间返回 Polyline 。 与 Polyline.positionAlongLine 方法相似,但是会在折线的两点之间(而不是在单点)返回折线段。

名称 说明 数据类型

start_measure

The starting distance from the beginning of the line.

Double

end_measure

The ending distance from the beginning of the line.

Double

use_percentage

(可选)

Specifies whether the start and end measures are used as a percentage.

If True, the start_measure and end_measure parameter values are used as a percentage. If False, the start_measure and end_measure parameter values are used as a distance. For percentages, the measures should be expressed as a double from 0.0 (0 percent) to 1.0 (100 percent).

(默认值为 False)

Boolean

返回值

数据类型 说明

PolyLine

两点之间的线段。

snapToLine(in_point)

基于捕捉到此几何的点返回新点。

名称 说明 数据类型

in_point

The point (PointGeometry or Point) that will be snapped to the line.

PointGeometry

返回值

数据类型 说明

PointGeometry

捕捉到的点。

symmetricDifference(other)

构造一个几何,该几何由两个几何的并集减去其交集形成。

两个输入几何必须为同一 shape 类型。

symmetricDifference 运算符

名称 说明 数据类型

other

A second geometry.

Object

返回值

数据类型 说明

Object

生成的几何。

touches(second_geometry)

指定几何的边界是否相交。

当两个几何的交集不为空,但它们内部的交集为空时,说明两个几何接触。 例如,仅当点与折线的一个终点重合时,才表示点与折线接触。

本图仅显示 True 关系。

可能的接触关系

名称 说明 数据类型

second_geometry

A second geometry.

Object

返回值

数据类型 说明

Boolean

返回几何的边界是否相交。

union(other)

构造一个几何,该几何是输入几何的并集。

两个几何必须具有同一形状类型。

结果是单个几何,它是两个输入几何的组合。 任一输入几何中的任何内容都将成为结果的一部分。 但是,两个几何共有的内容在结果中只出现一次。

输入几何的顺序对输出没有影响。

联合运算符

名称 说明 数据类型

other

The second geometry.

Object

返回值

数据类型 说明

Object

生成的几何。

within(second_geometry, {relation})

指定基础几何是否位于比较几何之内。

within 方法是与 contains 方法相反的运算符。

本图仅显示 True 关系。

可能的被包含关系

如果基础几何是这些几何的交集且其内部交集不为空,则基础几何位于比较几何之内。 within 方法是 Clementini 运算符,在空的基础几何中除外。

名称 说明 数据类型

second_geometry

A second geometry.

Object

relation

(可选)

Specifies the spatial relationship type that will be used.

  • BOUNDARY—The relationship has no restrictions for interiors or boundaries.

  • CLEMENTINI— Interiors of geometries must intersect. This option is equivalent to specifying None. This is the default.

  • PROPER— Boundaries of geometries must not intersect.

(默认值为 None)

String

返回值

数据类型 说明

Boolean

返回基础几何是否位于比较几何之内。

代码示例

几何示例

如果将地理处理工具的输出参数设置为空 Geometry 对象,则该工具将返回 Geometry 对象列表。

import arcpy

# Run the Copy Features tool, setting the output to the geometry object.
# geometries is returned as a list of geometry objects.
geometries = arcpy.management.CopyFeatures("c:/data/streets.shp",
                                           arcpy.Geometry())

# Walk through each geometry, totaling the length
length = 0
for geometry in geometries:
    length += geometry.length

print("Total length: {0}".format(length))