arcgis python xlstoshp
import xlrd # must init xlrd
import arcpy # param
arcpy.env.workspace = r"F:\note\python\ArcPy" #workspace
excelPath = r"test.xlsx" # excel file path
excelTableIndex = 0 # excel's table index
outName = r"point.shp" # out file excel = xlrd.open_workbook('test.xlsx') # get excel
table = excel.sheets()[0] # get table by sheets index
nrows = table.nrows # number of table's row
# get data
pointGeometryList = [] # a list to hold the PointGeometry objects
point = arcpy.Point() #create an empty Point object
spRef = arcpy.SpatialReference('WGS84 ARC System Zone 18') for i in range(1,nrows): # get row once
x = table.cell(i,0).value
y = table.cell(i,1).value
point.X = float(x)
point.Y = float(y)
pointGeometry = arcpy.PointGeometry(point,spRef)
pointGeometryList.append(pointGeometry) arcpy.CopyFeatures_management(pointGeometryList,outName) # save the shape file
---------------------
版权声明:本文为CSDN博主「PasserQi」的原创文章,遵循CC 4.0 by-sa版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/summer_dew/article/details/78116722 =======================================修改===================================================
import xlrd # must init xlrd
import arcpy
import os # param
arcpy.env.workspace = r"F:\kktemp" #workspace
excelPath = r"sss.xlsx" # excel file path
excelTableIndex = 0 # excel's table index
outName = r"F:\kktemp\point.shp" # out file fileName=r'F:\kktemp\sss.xlsx'
if os.path.exists(fileName):
excel = xlrd.open_workbook(fileName) # get excel
table = excel.sheets()[0] # get table by sheets index
nrows = table.nrows # number of table's row
# get data
pointGeometryList = [] # a list to hold the PointGeometry objects
point = arcpy.Point() #create an empty Point object
#spRef = arcpy.SpatialReference('Xian_1980_3_Degree_GK_CM_111E') for i in range(1,nrows): # get row once
x = table.cell(i,0).value
y = table.cell(i,1).value
point.X = float(x)
point.Y = float(y)
pointGeometry = arcpy.PointGeometry(point)
pointGeometryList.append(pointGeometry) arcpy.CopyFeatures_management(pointGeometryList,outName) # save the shape file
arcgis python xlstoshp的更多相关文章
- 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人门到精通目录基于ArcGIS10.2,100以上案例15章42个视频806分钟,51GIS网站上线
ArcGIS Python人门到精通目录 闫老师 QQ:276529800 微信13108507190 1. ArcGIS Python基础 1.1 ArcGIS为什么学习Python 1.2 A ...
- arcpy arcgis python实例教程--原点夹角距离定义线(坐标正算)
arcpy arcgis python实例教程--原点夹角距离定义线(坐标正算) 商务合作,科技咨询,版权转让:向日葵,135-4855__4328,xiexiaokui#qq.com 此地理处理工具 ...
- arcgis python获得字段唯一值
arcgis python获得字段唯一值 # Import native arcgisscripting moduleimport arcgisscripting, sys# Create the g ...
- 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脚本——遍历输出面或折线要素的折点坐标
有示例要素类如下 经过下面代码处理 #遍历输出面或折线要素的折点坐标 #infc:输入要素类 # code source: https://www.cnblogs.com/yzhyingcool/# ...
随机推荐
- Mysql基础学习_Windows版(一)
1.Mysql简介 Mysql是一种关系数据库管理系统,关系数据库将数据保存在不同的表中,而不是将所有数据放在一个大仓库内,这样就增加了速度并提高了灵活性.所谓的关系型数据库,是建立在关系模型基础上的 ...
- 【转载】Android性能优化之渲染篇
下面是渲染篇章的学习笔记,欢迎大家一起学习交流! 1)Why Rendering Performance Matters 现在有不少App为了达到很华丽的视觉效果,会需要在界面上层叠很多的视图组件,但 ...
- ffmpeg 命令的使用
当然先安装了 gentoo 下一条命令搞定 emerge ffmpeg 格式转换 (将file.avi 转换成output.flv) ffmpeg -i file.avi output.flv ...
- vagrant 搭建开发环境
虚拟机盒子地址 https://app.vagrantup.com/boxes/search vagrant init hirocom/centos7.2vagrant up 修改配置 config. ...
- tornado基本使用一
一.tornado web程序编写思路 . 创建web应用实例对象,第一个初始化参数为路由映射列表 . 定义实现路由映射列表中的handler类 . 创建服务器实例, 绑定服务器端口 . 启动当前线程 ...
- 11 Windows编程——定时器
周期性的发送WWL_TIMER消息的一个东西,这个周期可以由程序员自己设定.设定周期的数是SetTimer,停止定时器消息发送的函数是:Killximer: 定时器消息的特点: 1.不准确(也就是说, ...
- linux(centos)下安装supervisor进程管理工具
在接触supervisor进程管理工具之前,使用springboot打包部署到linux服务器的流程是这样子的,如下图所示: 上图展示的就是最一般的流程,如果项目是小项目或者demo可以这样子去部署, ...
- Kinect for Windows SDK开发入门(二):基础知识 上
原文来自:http://www.cnblogs.com/yangecnu/archive/2012/03/31/KinectSDK_Application_Fundamentals_Part1.htm ...
- Reverse链表
之前学习了关于reverse数组相关的东东(http://www.cnblogs.com/webor2006/p/6727419.html),这次再来对链表进行reverse一下,在面试中也很容易被问 ...
- SP15637 GNYR04H - Mr Youngs Picture Permutations[DP]
题目来源:POJ:http://poj.org/problem?id=2279 SPOJ:https://www.spoj.com/problems/GNYR04H/ 题意翻译 题目描述 杨先生希望为 ...