import arcpy

infc = arcpy.GetParameterAsText(0)

# Identify the geometry field
#
desc = arcpy.Describe(infc)
shapefieldname = desc.ShapeFieldName # Create search cursor
#
rows = arcpy.SearchCursor(infc) # Enter for loop for each feature/row
#
for row in rows:
# Create the geometry object
#
feat = row.getValue(shapefieldname) # Print the current multipoint's ID
#
print "Feature %i:" % row.getValue(desc.OIDFieldName)
partnum = 0 # Step through each part of the feature
#
for part in feat:
# Print the part number
#
print "Part %i:" % partnum # Step through each vertex in the feature
#
for pnt in feat.getPart(partnum):
if pnt:
# Print x,y coordinates of current point
#
print pnt.X, pnt.Y
else:
# If pnt is None, this represents an interior ring
#
print "Interior Ring:"
partnum += 1

改进代码

# -*- coding: cp936 -*-
import arcpy infc = arcpy.GetParameterAsText(0) # Identify the geometry field
#
desc = arcpy.Describe(infc)
shapefieldname = desc.ShapeFieldName # Create search cursor
#
rows = arcpy.SearchCursor(infc) # Enter for loop for each feature/row
#
for row in rows:
# Create the geometry object
#
feat = row.getValue(shapefieldname) # Print the current multipoint's ID
#
arcpy.AddMessage("Feature %i:" % row.getValue(desc.OIDFieldName))
print "Feature %i:" % row.getValue(desc.OIDFieldName)
partnum = 0 # Step through each part of the feature
#
for part in feat:
# Print the part number
#
print "Part %i:" % partnum
arcpy.AddMessage("Part %i:" % partnum)
# Step through each vertex in the feature
#
i=0
for pnt in feat.getPart(partnum):
if pnt:
# Print x,y coordinates of current point
#
print pnt.X, pnt.Y
arcpy.AddMessage("i="+str(i)+",X="+str(pnt.X)+", Y="+str(pnt.Y))
else:
# If pnt is None, this represents an interior ring
#
print "Interior Ring:"
arcpy.AddMessage("Interior Ring:")
i=i+1
partnum += 1

输出坐标如下

消息
执行: 获得坐标 fw_1
开始时间: Mon May 13 08:31:04 2019
正在运行脚本 获得坐标...
Feature 660:
Part 0:
i=0,X=57219.7552977, Y=86478.4272009
i=1,X=57797.135264, Y=86224.559745
i=2,X=57266.9342054, Y=86029.10427
i=3,X=57219.7552977, Y=86478.4272009
Interior Ring:
i=5,X=57345.5657184, Y=86314.4243312
i=6,X=57408.4709287, Y=86170.6409933
i=7,X=57514.0618175, Y=86278.4784967
i=8,X=57345.5657184, Y=86314.4243312
Completed script 获得坐标...
成功 在 Mon May 13 08:31:04 2019 (经历的时间: 0.00 秒)

ArcGIS Python 获得坐标的更多相关文章

  1. arcpy arcgis python实例教程--原点夹角距离定义线(坐标正算)

    arcpy arcgis python实例教程--原点夹角距离定义线(坐标正算) 商务合作,科技咨询,版权转让:向日葵,135-4855__4328,xiexiaokui#qq.com 此地理处理工具 ...

  2. ArcGIS Python人门到精通目录基于ArcGIS10.2,100以上案例15章42个视频806分钟,51GIS网站上线

    ArcGIS Python人门到精通目录 闫老师 QQ:276529800 微信13108507190 1.  ArcGIS Python基础 1.1  ArcGIS为什么学习Python 1.2 A ...

  3. ArcGis Python常用脚本

    ArcGis Python脚本——ArcGIS 中使用的 Python 是什么版本 ArcGis Python脚本——批量添加字段 ArcGis Python脚本——批量删除字段 ArcGis Pyt ...

  4. 【ArcGIS遇上Python】ArcGIS Python批处理入门到精通实用教程目录

    目录 1. 专栏简介 2. 专栏地址 3. 专栏目录 1. 专栏简介 Python语言是目前很火热的语言,极大的促进了人工智能发展.你知道在ArcGIS中也会有python的身影吗?事实上,在ArcG ...

  5. arcgis python arcpy add data script添加数据脚本

    arcgis python arcpy add data script添加数据脚本mxd = arcpy.mapping.MapDocument("CURRENT")... df ...

  6. ArcGIS Python编程案例-电子资料链接

    ArcGIS Python编程案例(1)-Python语言基础 https://www.jianshu.com/p/dd90816d019b ArcGIS Python编程案例(2)-使用ArcPy编 ...

  7. arcgis python脚本工具实例教程—栅格范围提取至多边形要素类

    arcgis python脚本工具实例教程-栅格范围提取至多边形要素类 商务合作,科技咨询,版权转让:向日葵,135-4855_4328,xiexiaokui#qq.com 功能:提取栅格数据的范围, ...

  8. arcgis python获得字段唯一值

    arcgis python获得字段唯一值 # Import native arcgisscripting moduleimport arcgisscripting, sys# Create the g ...

  9. ArcGis Python脚本——遍历输出面或折线要素的折点坐标

    有示例要素类如下 经过下面代码处理 #遍历输出面或折线要素的折点坐标 #infc:输入要素类 # code source: https://www.cnblogs.com/yzhyingcool/# ...

随机推荐

  1. 【转】Fetch超时设置和终止请求

    原文链接:https://www.cnblogs.com/yfrs/p/fetch.html 1.基本使用 Fetch 是一个新的端获取资源的接口,用于替换笨重繁琐XMLHttpRequest.它有了 ...

  2. asp.net 代码片段的

    片段标签                                                   说明 <%                                      ...

  3. C++ STL 之 multimap案例之员工分组

    #include <iostream> #include <vector> #include <map> #include <string> #incl ...

  4. 安卓开发之获取SD卡空间数据

    package com.lidaochen.getsdcardspace; import android.os.Environment; import android.support.v7.app.A ...

  5. LEANGOO用户设置

    转自:https://www.leangoo.com/leangoo_guide/leangoo_guide_kanban_user.html#toggle-id-7 1. 点击屏幕右上角头像或用户名 ...

  6. ESP8266开发环境、编译、烧录

    官方地址 中:http://www.espressif.com/zh-hans/support/download/overview?keys=&field_type_tid[]=14 英:ht ...

  7. Short XSS

    Short XSS Crackkay · 2013/08/21 12:17 0x00 背景 关键时候长度不够怎么办? 在实际的情况中如果你不够长怎么办呢?看医生?吃药?做手术?............ ...

  8. impala 下的SQL操作

    1.修改字段中文名称 ALTER TABLE tablename CHANGE doc_rev_ind  doc_rev_ind varchar(40) comment '收取要求' 2.增加一列 A ...

  9. Linux下安装opencv(踩坑记录帖)

    1.首先安装依赖项:sudo apt install build-essential sudo apt install build-essentialsudo apt install cmake gi ...

  10. Python之datetime模块

    datatime模块重新封装了time模块,提供更多接口,提供的类有:date,time,datetime,timedelta,tzinfo. 1.date类 datetime.date(year, ...