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的更多相关文章

  1. arcgis python arcpy add data script添加数据脚本

    arcgis python arcpy add data script添加数据脚本mxd = arcpy.mapping.MapDocument("CURRENT")... df ...

  2. ArcGIS Python编程案例-电子资料链接

    ArcGIS Python编程案例(1)-Python语言基础 https://www.jianshu.com/p/dd90816d019b ArcGIS Python编程案例(2)-使用ArcPy编 ...

  3. arcgis python脚本工具实例教程—栅格范围提取至多边形要素类

    arcgis python脚本工具实例教程-栅格范围提取至多边形要素类 商务合作,科技咨询,版权转让:向日葵,135-4855_4328,xiexiaokui#qq.com 功能:提取栅格数据的范围, ...

  4. ArcGIS Python人门到精通目录基于ArcGIS10.2,100以上案例15章42个视频806分钟,51GIS网站上线

    ArcGIS Python人门到精通目录 闫老师 QQ:276529800 微信13108507190 1.  ArcGIS Python基础 1.1  ArcGIS为什么学习Python 1.2 A ...

  5. arcpy arcgis python实例教程--原点夹角距离定义线(坐标正算)

    arcpy arcgis python实例教程--原点夹角距离定义线(坐标正算) 商务合作,科技咨询,版权转让:向日葵,135-4855__4328,xiexiaokui#qq.com 此地理处理工具 ...

  6. arcgis python获得字段唯一值

    arcgis python获得字段唯一值 # Import native arcgisscripting moduleimport arcgisscripting, sys# Create the g ...

  7. ArcGis Python常用脚本

    ArcGis Python脚本——ArcGIS 中使用的 Python 是什么版本 ArcGis Python脚本——批量添加字段 ArcGis Python脚本——批量删除字段 ArcGis Pyt ...

  8. 【ArcGIS遇上Python】ArcGIS Python批处理入门到精通实用教程目录

    目录 1. 专栏简介 2. 专栏地址 3. 专栏目录 1. 专栏简介 Python语言是目前很火热的语言,极大的促进了人工智能发展.你知道在ArcGIS中也会有python的身影吗?事实上,在ArcG ...

  9. ArcGis Python脚本——遍历输出面或折线要素的折点坐标

    有示例要素类如下 经过下面代码处理 #遍历输出面或折线要素的折点坐标 #infc:输入要素类 # code source: https://www.cnblogs.com/yzhyingcool/# ...

随机推荐

  1. vue cli3 打包到tomcat上报错问题

    首先  项目打包步骤 1.vue config.js  添加 publicPath: './', // 公共路径 assetsDir:'static', 2.将代理注释掉 proxy 3.将hash需 ...

  2. canvas验证码实现

    1 <!DOCTYPE html> <html> <!-- head --> <head> <meta charset="utf-8&q ...

  3. Flutter学习之Dart语言基础(构造函数)

    最常见的构造函数形式,即生成构造函数,创建一个类的新实例: class Point { num x, y; //Dart中int和double是num的子类 //this引用当前类对象 Point(n ...

  4. IDEA 使用与总结

    一.IDEA和常用软件下载1.IDEA激活码网站:http://idea.lanyus.com/常用软件网站 idea : https://www.jetbrains.com/idea/downloa ...

  5. 【异常】ser class threw exception: java.sql.SQLException: The last packet successfully received from the server was 39,444 milliseconds ago. The last

    1 详细异常 ser class threw exception: java.sql.SQLException: The last packet successfully received from ...

  6. arduino安装出现驱动程序不适用于该平台

    之前重新安装了系统,然后重新安装arduino驱动的时候出现了之前没遇到过的问题,这里记录一下. 现在装的是win7 64位的系统,先去官方下载(官方下载慢的,可以去相关论坛下载),有安装版和解压版的 ...

  7. 标准库类型之string

    上几篇中已经实现了一个简单版的String字符串类,但是实际开发中不用我们自己实现了,学习Java的也知道有一个系统现成的用,当然强大的C++也不例外,下面就来学习一下系统定义的string是怎么用的 ...

  8. centos7下redis和php-redis安装

    centos7下redis安装和php-redis扩展安装 //一直yes就可以了 yum install redis //配置 whereis redis.conf vi /etc/redis.co ...

  9. IAR添加debug和release选项

    在IAR的Workspace窗口顶部的下拉菜单中有两个选项,Debug和Release. 名字和数量可以在菜单栏的Project-->Edit Configuration中增删修改 每个选项都对 ...

  10. 2019牛客多校第五场 generator 1——广义斐波那契循环节&&矩阵快速幂

    理论部分 二次剩余 在数论中,整数 $X$ 对整数 $p$ 的二次剩余是指 $X^2$ 除以 $p$ 的余数. 当存在某个 $X$,使得式子 $X^2 \equiv d(mod \ p)$ 成立时,称 ...