Point

摘要

x,y 对的制图表达,可以选择带有测量值、高度和 ID 属性。

说明

Point 对象不包括空间参考信息,并且经常用于构造其他几何对象,包括 PointGeometryPolylinePolygonMultipoint 对象。 在下列示例中,Point 对象用于创建 PointGeometry 对象。

pt = arcpy.Point(-12683890.6, 5811151.5)
pt_geometry = arcpy.PointGeometry(pt, spatial_reference=arcpy.SpatialReference(3857))

语法

 Point ({X}, {Y}, {Z}, {M}, {ID})
参数说明数据类型
X

The x-coordinate of the point.

(默认值为 0.0)

Double
Y

The y-coordinate of the point.

(默认值为 0.0)

Double
Z

The z-coordinate of the point.

(默认值为 None)

Double
M

The m-value of the point.

(默认值为 None)

Double
ID

The shape ID of the point.

(默认值为 0)

Integer

属性

属性说明数据类型
ID
(可读写)

用于唯一标识点的整数。

Integer
M
(可读写)

点的测量值。

Double
X
(可读写)

点的水平坐标。

Double
Y
(可读写)

点的垂直坐标。

Double
Z
(可读写)

点的高程值。

Double

方法概述

方法说明
clone (point_object)

克隆 Point 对象。

contains (second_geometry, {relation})

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

contains 方法与 within 方法相反。

本图仅显示 True 关系。

可能的包含关系

crosses (second_geometry)

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

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

本图仅显示 True 关系。

可能的交叉关系

disjoint (second_geometry)

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

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

本图仅显示 True 关系。

可能的不相交关系

equals (second_geometry)

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

本图仅显示 True 关系。

可能的相等关系

overlaps (second_geometry)

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

本图仅显示 True 关系。

可能的叠置关系

touches (second_geometry)

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

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

本图仅显示 True 关系。

可能的接触关系

within (second_geometry, {relation})

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

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

本图仅显示 True 关系。

可能的被包含关系

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

方法

clone (point_object)
参数说明数据类型
point_object

A Point object.

Point
contains (second_geometry, {relation})
参数说明数据类型
second_geometry

A second geometry.

Object
relation

Specifies the spatial relationship type that will be used.

  • BOUNDARYThe 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

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

crosses (second_geometry)
参数说明数据类型
second_geometry

A second geometry.

Object
返回值
数据类型说明
Boolean

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

disjoint (second_geometry)
参数说明数据类型
second_geometry

A second geometry.

Object
返回值
数据类型说明
Boolean

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

equals (second_geometry)
参数说明数据类型
second_geometry

A second geometry.

Object
返回值
数据类型说明
Boolean

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

overlaps (second_geometry)
参数说明数据类型
second_geometry

A second geometry.

Object
返回值
数据类型说明
Boolean

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

touches (second_geometry)
参数说明数据类型
second_geometry

A second geometry.

Object
返回值
数据类型说明
Boolean

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

within (second_geometry, {relation})
参数说明数据类型
second_geometry

A second geometry.

Object
relation

Specifies the spatial relationship type that will be used.

  • BOUNDARYThe 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

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

代码示例

Point 示例

创建 Point 对象并打印一些属性。

import arcpy

# Create point object
point = arcpy.Point(2000, 2500)

# Print point properties
print("Point properties:")
print(" X:  {0}".format(point.X))
print(" Y:  {0}".format(point.Y))
Point 示例 2

检查从 Polygon 对象返回的 Point 对象。

import arcpy

# Create cursor to retrieve Hawaii shape
feature_class = "c:/data/Hawaii.shp"
cursor = arcpy.da.SearchCursor(feature_class, ["SHAPE@"])

for row in cursor:
    # Get the geometry object from the shape field
    print("Number of Hawaiian islands: {0}".format(row[0].partCount))

    # GetPart returns an array of point objects for each part.
    for island in row[0].getPart():
        print("Vertices in island: {0}".format(island.count))
        for point in island:
            print("X: {0}, Y: {1})".format(point.X, point.Y))

相关主题