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/# ...
随机推荐
- vue 钩子函数的初接触
vue-router的路由钩子函数: 第一种:全局钩子函数. router.beforeEach((to, from, next) => { console.log('beforeEach') ...
- 如何用SAP WebIDE的Fiori创建向导基于ABAP OData service快速创建UI5应用
如果我们手上已经有可以正常工作的OData服务,无论位于ABAP on-premise系统还是public上的internet OData service,都可以用SAP WebIDE里的Fiori创 ...
- ant design pro超详细入门教程
1.Ant Design Pro 初了解 说到ant design pro,得先了解一下ant design是个什么东西?ant design蚂蚁金服基于react打造的一个服务于企业级产品的UI框架 ...
- nohub
nohup command > myout.file 2>&1 & nohup command > /dev/null 2>&1 &
- python2,3区别
Python2 Python3 default charset ascii(can change) utf-8 print 可不加括号 必须加 range 有xrange()生成器 可转换为ran ...
- 后台向前台响应的json数据格式的一些问题
最近在写后台向前台easyUI页面发送数据时遇到的一些报错. 首先easyUI内部封装了许多的方法和对象,以至于很多参数都不清楚,需要查询,其次easyUI也是有内置ajax所以从后台响应回来的数据一 ...
- zencart随机获取一张产品图片及价格小程序
<?php //header("content-Type: text/html; charset=utf-8"); //@set_time_limit(1800); //@i ...
- Red Hat Enterprise Linux 7.0
简介 Red Hat Enterprise Linux是Red Hat公司的Linux发行版,面向商业市场,包括大型机.红帽公司从Red Hat Enterprise Linux 5开始对企业版LIN ...
- mongodb 启动数据库失败原因及解决办法
刚开始接触mongodb 每次启动完数据库 用好之后退出时直接 command+q强制退出了 导致了下一次数据库启动失败 错误原因: 上一次退出数据库端口号并没有杀死 解决办法 lsof -i tc ...
- Pycharm----设置默认脚本请求头
每次新建py文件,均需要在文件头部加上编码声明,每次的手动添加比较麻烦,因此设置自动生成,也可添加作者.时间等等,详见如下: 设置后的样例显示: 操作方式: 操作完如上的截图步骤,再次新建一个py文件 ...