ArcGIS Python 获得坐标
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 获得坐标的更多相关文章
- arcpy arcgis python实例教程--原点夹角距离定义线(坐标正算)
arcpy arcgis python实例教程--原点夹角距离定义线(坐标正算) 商务合作,科技咨询,版权转让:向日葵,135-4855__4328,xiexiaokui#qq.com 此地理处理工具 ...
- ArcGIS Python人门到精通目录基于ArcGIS10.2,100以上案例15章42个视频806分钟,51GIS网站上线
ArcGIS Python人门到精通目录 闫老师 QQ:276529800 微信13108507190 1. ArcGIS Python基础 1.1 ArcGIS为什么学习Python 1.2 A ...
- ArcGis Python常用脚本
ArcGis Python脚本——ArcGIS 中使用的 Python 是什么版本 ArcGis Python脚本——批量添加字段 ArcGis Python脚本——批量删除字段 ArcGis Pyt ...
- 【ArcGIS遇上Python】ArcGIS Python批处理入门到精通实用教程目录
目录 1. 专栏简介 2. 专栏地址 3. 专栏目录 1. 专栏简介 Python语言是目前很火热的语言,极大的促进了人工智能发展.你知道在ArcGIS中也会有python的身影吗?事实上,在ArcG ...
- arcgis python arcpy add data script添加数据脚本
arcgis python arcpy add data script添加数据脚本mxd = arcpy.mapping.MapDocument("CURRENT")... df ...
- ArcGIS Python编程案例-电子资料链接
ArcGIS Python编程案例(1)-Python语言基础 https://www.jianshu.com/p/dd90816d019b ArcGIS Python编程案例(2)-使用ArcPy编 ...
- arcgis python脚本工具实例教程—栅格范围提取至多边形要素类
arcgis python脚本工具实例教程-栅格范围提取至多边形要素类 商务合作,科技咨询,版权转让:向日葵,135-4855_4328,xiexiaokui#qq.com 功能:提取栅格数据的范围, ...
- arcgis python获得字段唯一值
arcgis python获得字段唯一值 # Import native arcgisscripting moduleimport arcgisscripting, sys# Create the g ...
- ArcGis Python脚本——遍历输出面或折线要素的折点坐标
有示例要素类如下 经过下面代码处理 #遍历输出面或折线要素的折点坐标 #infc:输入要素类 # code source: https://www.cnblogs.com/yzhyingcool/# ...
随机推荐
- 阅读文章《DDD 领域驱动设计-如何 DDD?》的阅读笔记
文章链接: https://www.cnblogs.com/xishuai/p/how-to-implement-ddd.html 文章作者: 田园里的蟋蟀 首先感谢作者写出这么好的文章. 以下是我的 ...
- 正则表达式split匹配多种例如 “】”,“,”两种(页面级中英文切换方案)
在做登陆界面的时候,因为涉及到中英文 因为前后台已经分离,所以前端需要自行设计中英文 做法: 编写两个文件,一个中文文件,一个是英文文件,分别放在对应的目录下面 文件的内容 { "login ...
- ES6模块化及优点,简单案例让你秒懂
模块化:模块是一个文件 好处: 1.减少命名冲突 2.避免引入时的层层依赖 3.可以提升执行效率 **第一种方法************ ...
- MYSQL WHERE语句
过滤条件(WHERE) 如果你失忆了,希望你能想起曾经为了追求梦想的你. QQ群:651080565(php/web 学习课堂) 例子:淘宝首页上,我们会看到很多个商品,但这些商品,并不是 ...
- MUI 结合layui实现分页
mui自带有分页,在ui上我还是认为layui的友好点. 第三方插件: template-web.js-----------------前端数据绑定 layui.js.layui.css------- ...
- 如何用Visual Studio Code远程调试运行在服务器上的nodejs应用
假设我有一个nodejs应用,运行在AWS - 亚马逊云平台上(Amazone Web Service).我想用本地的Visual Studio Code来远程调试服务器端的nodejs应用. Vis ...
- LintCode上的一道算法面试题: 数字的统计
说到数字的统计,小时候的数学课大家都应该有学过,但数字太多太复杂的,手动肯定耗时间不说还很容易出错.所以今天分享一下如何用程序来完成. Have you met this question in a ...
- web开发:定位布局
一.盒子的显隐 二.小米topbar 三.相对定位 四.决定定位 五.固定定位 六.z-index属性 七.流式布局思想 八.hover父子悬浮 一.盒子的显隐 1.同一结构下, 如果采用浮动布局,所 ...
- 微信小程序开发(四)页面跳转
承接上篇博客. 通过点击按钮跳转到新的页面. 先创建新页面home: 代码如下: // home.js Page({}) // 注册页面 // home.json {} // home.wxml &l ...
- 2. An Array of Sequences
1. Overview of Built-In Sequences Container sequences: list, tuple, and collections.deque can hold i ...