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/# ...
随机推荐
- css———详解height与line_height
定义 height指的是块级别元素的高度: line-height指的是元素内容的高度. height和line-height的联系 CSS中起高度作用的应该就是height以及line-height ...
- 不怕你配置不会,就怕你看的资料不对!MIM 与 SharePoint 同步完全配置指南。
为了更好的同步 User Profile,在 SharePoint 2010 中首次引入了 FIM (ForeFront Identity Manager) 用于编辑 User Profile 的同期 ...
- 5.Servlet 对象(request-response)
/*ServletResponse*/ /*responese常见应用*/ 1.向客户端输出中文数据 (分别以OutputStream 和 PrintWriter输出) 2.文件下载和中文文件的下载 ...
- java程序启动极慢的问题处理
在程序部署过程中,遇到一次java程序启动极慢的情况 参考:https://www.iteye.com/blog/windshome-1836885 原部署环境是有外网的,启动java极快 后来极其修 ...
- DevExpress VCL 19.2.3 Skin找不到皮肤
The location where the DX Designtime Loader is looking for the skin packages has changed again ! For ...
- 【6】Zookeeper脚本及API
一.客户端脚本 1.1.客户端连接 cd /usr/local/services/zookeeper/zookeeper-3.4.13/bin ##连接本地Zookeeper服务器 sh zkCli. ...
- Django—ModelForm
简介 Model + Form ==> ModelForm.model和form的结合体,所以有以下功能: 验证 数据库操作 Form回顾 models.py class UserType(mo ...
- Ubuntu系统---以virtualenv方式安装Tensorflow-CPU
Ubuntu系统---以virtualenv方式安装Tensorflow-CPU 一.安装环境 环境:Ubuntu18.04+CPU+python2.7 本文介绍:如何在ubuntu上以virtual ...
- CSS基础学习 21.CSS居中总结
注意:*在IE中并不代表通配符的意思,是代表根元素的意思,所以为了匹配适应各种浏览器,进行页面初始化 <style> *{ margin:0; padding:0; } </styl ...
- AI行业精选日报_人工智能(12·23)
日本探索用人工智能指挥交通 据日本共同社报道,日本一家机构正在研究开发一套新的交通系统,将应用人工智能技术分析数据来缓解城市交通拥堵.报道称,在日本新能源和产业技术综合开发机构研发的这套系统中,人工智 ...