栏目链接:
快捷导航:
我的位置:首页 > 拓展学习 > 知识文档资源
ArcGIS中计算多边形中心点坐标

方法一:获取polygon的中心点坐标,可使用field calculation

其ArcGIS Help中的英文解释为:
Adding the x,y coordinates of the centroid of a polygon layer to a new field

1). Optionally, start an edit session in ArcMap. Calculating a field is faster outside of an edit session, but you won't be able to undo the calculation.

2). Open the attribute table of the layer of the layer you want to edit.
3). Right-click the field heading for the X field (if there is no X field you can add a new field by clicking the options button and selecting the new field option).

4). Click Calculate Values.

5). Check Advanced.

6). Type the following VBA statement in the first text box.
Dim Output As Double
Dim pArea As IArea
Set pArea = [Shape]
Output = pArea.Centroid.X

7). Type the variable Output in the text box directly under the X field name.

8). Click OK.
You can repeat the same process for updating a field with the Y coordinates for the centroid point of each polygon in the layer.
Tip
? The property X returns a field type of double. For best results, your X field should also be a double field type.

首先打开要提取中心点坐标的多边形图层属性表,在要提取坐标的X Field(如果没有先创建,最好是double型)中的右键单击,选择Field Calculator,再选中Advanced,在Pre-Logic VBA Script Code中输入代码:
获取X坐标:
Dim Output As Double
Dim pArea As IArea
Set pArea = [Shape]
Output = pArea.Centroid.X

在输出框中输入:Output
单击OK,获取多边形X坐标

同理获取Y坐标:
代码为:
Dim Output As Double
Dim pArea As IArea
Set pArea = [Shape]
Output = pArea.Centroid.Y

方法二:分别建立两Field用于计算X,Y左边,右键单击选择Calculate Geometry,在property中分别选择X Coordinate of Centroid或者Y Coordinate of Centroid用于计算各多边形质心的坐标点,在Coordinate System 中选择Use Coordinate system of the data source,在下面的Units中根据需要选择各种表示形式,点击OK,完成操作。
此方法还可以计算多边形的面积和周长。

版权所有@2013-2014 广西师范学院资源与环境科学学院 《遥感导论》网络课程,网站内容严禁抄袭复制
地址:中国南宁市明秀东路175号 邮编:530001
未经授权禁止转载、摘编、复制或建立镜像,如有违反,追究法律责任。