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. 设置自己的bat运行文件-自己用,随时扩展

    start "" "E:\SEST_H5" start "" "C:\Program Files\Sublime Text 3\s ...

  2. 较新版FlowPortal BPM不能回车登录

    在BPM安装目录中找到路径:WEB\YZSoft\Login\2018\js\login.js 加回车登录代码如下 //回车登录 $('.yz-input.yzglyph.uid').bind('ke ...

  3. 【Java并发】基础

    一.概述 1.1 线程与进程区别 1.2 多线程引发的性能问题 二.多线程创建方式 2.1 第一种-继承Thread类 2.2 第二种-实现Runnable接口 2.3 第三种-实现Callable接 ...

  4. 《OpenCV图像处理编程实例》

    <OpenCV图像处理编程实例>例程复现 随书代码下载:http://www.broadview.com.cn/28573 总结+遇到的issue解决: 第一章 初识OpenCV 1.VS ...

  5. Azkaban无法启动错误Error: Could not find or load main class 12321

    1 错误日志 Using Hadoop from /mnt/software/hadoop-2.6.0-cdh5.16.1 bin/internal/../.. /mnt/software/jdk1. ...

  6. Django_06_项目完成

    项目完成 基本知识点都学完了,接下来完成示例项目 现在还需要的代码包括三个方面,三个方面顺序不分先后 1.定义视图 2.定义URLconf 3.定义模板 定义视图 编写booktest/views.p ...

  7. StringBuffer常用方法

    StringBuffer常用的方法 package com.mangosoft.java.string; /** * 字符串特点:字符串是常量,它们的值在创建之后不能更改. * * 字符串的内容一旦发 ...

  8. Java字节流read函数

    问题引入 做Java作业从标准输入流获取用户输入,用到了System.in.read(),然后出现了bug. //随机生成一个小写字母,用户猜5次,读取用户输入,并判断是否猜对 import java ...

  9. a 标签的download 属性在谷歌浏览器下无法下载图片,如何处理?

    a 标签的download属性在下载图片文件的时候是如何的方便,可是可是谷歌浏览器不支持下载,而是下载打开新窗口预览图片.这个兼容性问题如何解决呢? 了解了一番,HTMLCanvasElement.t ...

  10. hg如何回退到某个版本

    hg 如何回退 hg ... ? ? ?