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/# ...
随机推荐
- Go 缓冲信道
缓冲信道 语法结构:cap为容量 ch := make(chan type, cap) 缓冲信道支持len()和cap(). 只能向缓冲信道发送容量以内的数据. 只能接收缓冲信道长度以内的数据. 缓冲 ...
- 在IOS中根据圆心坐标、半径和角度计算圆弧上的点坐标
/** 日期:2015-10-15 版本: 1.0.0 -------------------------------------------------------------- 功能说明 ---- ...
- 解决ios8下coreData没有NSPersistentContainer的问题
用Xcode8.1默认创建ios app的时候,使用coreData的话,要10.0以上的版本才行.因为NSPersistentContainer只有10.0以上的版本才有,10.0以下的版本是没有的 ...
- CodeForces 822C Hacker, pack your bags!
题意 给出一些闭区间(始末+代价),选取两段不重合区间使长度之和恰为x且代价最低 思路 相同持续时间的放在一个vector中,内部再对起始时间排序,从后向前扫获取对应起始时间的最优代价,存在minn中 ...
- Linux网络管理——nslookup
使用参考: https://www.computerhope.com/unix/unslooku.htm https://www.thegeekstuff.com/2012/02/dig-comman ...
- 2.Storm集群部署及单词统计案例
1.集群部署的基本流程 2.集群部署的基础环境准备 3.Storm集群部署 4.Storm集群的进程及日志熟悉 5.Storm集群的常用操作命令 6.Storm源码下载及目录熟悉 7.Storm 单词 ...
- 用js刷剑指offer(二维数组中的查找)
题目描述 在一个二维数组中(每个一维数组的长度相同),每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序.请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数 ...
- 单元测试框架之unittest(六)
一.摘要 本片博文将介绍unittest框架的一些轻便有效的特性,在我们的测试中经常可以用到 如果有一些测试方法不想执行,如果有些测试方法在某些条件下不执行 该当如何? 如果有些方法未在unittes ...
- django创建路径导航
路径导航 : 1.怎样设置需要登录但又不需要验证权限的路径 : 在settings中定义一个列表,列表中以正则的方式放入需要登录但无需验证的权限的项.在 ...
- PHP mysqli_close() 函数
关闭先前打开的数据库连接: <?php $con=mysqli_connect("localhost","my_user","my_passwo ...