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

最新文章

  1. 【转】关于KDD Cup '99 数据集的警告,希望从事相关工作的伙伴注意
  2. Scala 深入浅出实战经典 第48讲:Scala类型约束代码实战及其在Spark中的应用源码解析
  3. MySQL性能参数详解 - max_connect_errors
  4. Powershell创建对象
  5. codevs 1922 骑士共存问题 网络流
  6. 通过SocketLog快速分析php程序
  7. java nio(一)buffer
  8. bzoj 1492: [NOI2007]货币兑换Cash
  9. H3C无线路由器安装与设置
  10. SQL - Order By如何处理NULL
  11. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第5章编程练习5
  12. c++常用小算法
  13. Django+easyui 快速开发
  14. web前端(13)—— 了解JavaScript,JavaScript的引入方式
  15. Django ModelForm 校验数据格式
  16. BZOJ.4555.[HEOI2016&TJOI2016]求和(NTT 斯特林数)
  17. Spring Boot 容器选择 Undertow 而不是 Tomcat
  18. Eclipse 设置代码风格
  19. 实践作业3:白盒测试----第三次小组会DAY8
  20. redis(2)数据类型

热门文章

  1. UDP及操作系统理论
  2. 解决ios中input兼容性问题
  3. ADF一个EO的事物提交周期
  4. macro 标签,和静态文件,以及templates
  5. Image Processing and Analysis_8_Edge Detection:Edge and line oriented contour detection State of the art ——2011
  6. Linux用户管理——useradd
  7. MySQL5.7安装详解及常见安装问题解决
  8. Linux开机启动项总结
  9. 【Java 基础 实验-抽象类应用的练习】(抽象类Employee被SalariedEmployee和HourEmployee继承 , 遍历,Scanner 输出)
  10. Selenium(十一)使用EXCEL读取用户数据和生成测试报表