参考了很多博客吧,最后把自己都改蒙了,这个博客有分析arcpy创建带高程的点图层、

# -*- coding: utf-8 -*-
"""
Created on Sun Apr  7 15:32:24 2019@author:
"""# XYTableToPoint.py
# Description: Creates a point feature class from input table# import system modules
import arcpy
import csv
# Set environment settings
import os
rootdir =
outpath=list = os.listdir(rootdir) #列出文件夹下所有的目录与文件
for i in range(0,len(list)):path = os.path.join(rootdir,list[i])print pathif os.path.isfile(path):
# Set the local variablesoutputname = path[40:57]+"_"+path[58:73]+".shp"print outputnamespatRef = arcpy.SpatialReference("WGS 1984") #"WGS 1984"in_table = path with open(in_table,'rb') as csvfile:reader = csv.reader(csvfile)column1 = [row[0] for row in reader]with open(in_table,'rb') as csvfile:reader = csv.reader(csvfile)    column2 = [row[1] for row in reader]with open(in_table,'rb') as csvfile:reader = csv.reader(csvfile)end_lon = [row[2] for row in reader]with open(in_table,'rb') as csvfile:reader = csv.reader(csvfile)    end_lat = [row[3] for row in reader]with open(in_table,'rb') as csvfile:reader = csv.reader(csvfile)distance = [row[4] for row in reader]with open(in_table,'rb') as csvfile:reader = csv.reader(csvfile)    speed = [row[5] for row in reader]with open(in_table,'rb') as csvfile:reader = csv.reader(csvfile)angle = [row[6] for row in reader]with open(in_table,'rb') as csvfile:reader = csv.reader(csvfile)    u = [row[7] for row in reader]with open(in_table,'rb') as csvfile:reader = csv.reader(csvfile)    v = [row[8] for row in reader]out_feature_class = "ice vector"x_coords = column1 #"longitude"y_coords = column2 # "latitude"fc=arcpy.CreateFeatureclass_management(outpath, outputname, "POINT", "","","", spatRef)arcpy.AddField_management(outpath+"\\"+outputname, "start_lon", "DOUBLE")arcpy.AddField_management(outpath+"\\"+outputname, "start_lat", "DOUBLE")arcpy.AddField_management(outpath+"\\"+outputname, "end_lon", "DOUBLE")arcpy.AddField_management(outpath+"\\"+outputname, "end_lat", "DOUBLE")arcpy.AddField_management(outpath+"\\"+outputname, "distance", "DOUBLE")#marcpy.AddField_management(outpath+"\\"+outputname, "speed", "DOUBLE")arcpy.AddField_management(outpath+"\\"+outputname, "angle", "DOUBLE")arcpy.AddField_management(outpath+"\\"+outputname, "u", "DOUBLE")arcpy.AddField_management(outpath+"\\"+outputname, "v", "DOUBLE")cursor=arcpy.InsertCursor(fc,["SHAPE@XY"]) # Add the point geometry to the feature vertex = arcpy.CreateObject("Point") vertex.X = line[0] vertex.Y =line[1] feature.shape = vertex # Add attributes feature.leibie = "shumu" # write to shapefile cursor.insertRow(feature) del cursor del fcnum=0for x in x_coords: feature = cursor.newRow() # Add the point geometry to the feature vertex = arcpy.CreateObject("Point") vertex.X = line[0] vertex.Y =line[1] feature.shape = vertex # Add attributes feature.leibie = "shumu" # write to shapefile cursor.insertRow(feature) del cursor del fc# Add the point geometry to the featurevertex = arcpy.CreateObject("Point")vertex.X = float(x)vertex.Y = float(y_coords[num])feature.shape = vertexfeature.start_lon = float(x)feature.start_lat = float(y_coords[num])feature.end_lon = float(x)feature.end_lat = float(y_coords[num])feature.distance = float(distance[num])feature.speed = float(speed[num])feature.angle = float(angle[num])feature.u = float(u[num])feature.v = float(v[num])#print vertex.X,vertex.Y,vertex.speedcursor.insertRow(feature)num=num+1arcpy.DefineProjection_management(outpath+"\\"+outputname,spatRef)# Add attributes
#z_coords = "elevation"# Make the XY event layer...
# =============================================================================
# =============================================================================#            newfc="newpoint.shp"
#            arcpy.CreateFeatureclass_management(outpath, newfc, "Point")
#            cursor=arcpy.da.InsertCursor(newfc, ["SHAPE@"])
#            array=arcpy.Array()#
#  # Print the total rows
#            print(arcpy.GetCount_management(out_feature_class))
# =============================================================================
# =============================================================================

arcpy利用XY创建点相关推荐

  1. Python利用经纬度创建shpfile点图层并生成tif

    利用shapefile创建shp点图层并添加投影,无需使用arcpy里面的CreateFeatureclass_management或者MakeXYEventLayer_management创建点图层 ...

  2. Java归去来第2集:利用Eclipse创建Maven Web项目

    一.前言 如果还不了解剧情,请返回第一集的剧情          Java归去来第1集:手动给Eclipse配置Maven环境 二.利用Eclipse创建Maven Web项目 选择File-New- ...

  3. Linux Namespace系列(09):利用Namespace创建一个简单可用的容器

    本文将演示如何利用namespace创建一个完整的容器,并在里面运行busybox.如果对namespace不是很熟悉,请先参考前面几遍介绍不同类型namespace的文章. busybox是一个Li ...

  4. asp利用dictionary创建二维数组

    这是asp利用dictionary创建二维数组的例子,这样做的优点是: 1.数组下标可以是字符串 2.长度不是固定的 <% '================================== ...

  5. 利用介质创建额外域控制器

    前面和大家聊了利用网络复制的方式来创建额外域控制器,但是在企业的时间应用中可能会遇到这样一种问题: 例如:北京有一个contoso.com的主域控制器,现在需要在上海创建额外域控制器,但是北京和上海之 ...

  6. 主线程是如何向子线程传递数据的?_c++ 利用thread创建线程

    用进行多线程开发 小时候,老师总是教育我们上课要专心,"一心不可二用".可是CPU这个不听话的"熊孩子"偏偏却在一个芯片中加入了两个甚至多个运算核心,想要一&q ...

  7. bcdedit添加linux引导,Linux_利用Bcdedit创建Linux系统引导,Bcdedit在Windows Vista中的一个命 - phpStudy...

    利用Bcdedit创建Linux系统引导 Bcdedit在Windows Vista中的一个命令行工具,用于建立和重新配置bootloader,无须再使用boot.ini文件.下面我们来谈谈如何用bc ...

  8. RN学习笔记02:利用WebStorm创建RN项目

    RN学习笔记02:利用WebStorm创建RN项目 在RN学习笔记01里,安装了node.js与react-native-cli,而且配置了环境变量. 在命令行环境,利用react-native in ...

  9. IOS基础学习日志(七)利用dispatch_once创建单例及使用

    自苹果引入了Grand Central Dispatch (GCD)(Mac OS 10.6和iOS4.0)后,创建单例又有了新的方法,那就是使用dispatch_once函数,当然,随着演进的进行. ...

  10. 利用Python创建Excel条形图

    利用Python创建Excel条形图 创建Excel条形图是学习Python办公自动化的扩展知识,我虽然这么说但是还是属于重要的内容之一.想要通过Python创建Excel图形我们需要用到函数open ...

最新文章

  1. python抖音批量点赞_python抖音三百条,悠悠一笑乐逍遥
  2. 移动开发必须要了解的易盾加固生态
  3. 一大波 Android 刘海屏来袭,全网最全适配技巧!
  4. 京瓷打印机几个常见密码
  5. Hive的union和join操作
  6. 删除隐藏版本信息 版本回退_Git系列之-分布式版本控制Git详解
  7. linux 安装x11 apt-get,Mac 安装apt-get
  8. 搜狗语音输入提示服务器繁忙,讯飞语音输入如何提高识别率 提高方法
  9. java中重写hashcode_Java中HashSet要重写equals方法和hashCode方法
  10. CodeForces Round #295 Div.2
  11. uni-app android权限
  12. Masscan:最快的互联网IP端口扫描器
  13. [网易博客]驱动力读后感
  14. 什么是金融衍生品工具?
  15. 结构化设计和模块设计
  16. GOOGLE 手机定位厘米挑战赛选手提到的技巧、方法总结
  17. 多重共线性是如何影响回归模型的
  18. 检测分割算法改进(篇一) YoloX和Yolov3-v5之FCOUS模块、CSP模块、SPP模块
  19. C站万字详解二叉树基本操作演示程序(附图)
  20. 学 Python 必看的书单汇总

热门文章

  1. 《高性能MYSQL》
  2. 软件测试之如何进行易用性测试?
  3. 强强联合!蚂蚁金服与新炬网络战略合作,共同致力于国产数据库的技术推广和生态建设
  4. HERO引擎传奇遇到的问题以及解决办法
  5. CocosCreator之场景编辑器介绍
  6. 电信提供的路由器无法进入配置地址或者配置后找不到自己WIFI的解决方法
  7. 计算机会计学ufo报表,UFO报表管理实验报告.doc
  8. 21天学通c语言pdf百度云,21天学通C语言「pdf+epub+mobi+txt+azw3」
  9. 哈理工OJ 1147 重生(水DP)
  10. 基于Mathemtica绘制一元酸滴定碱的滴定曲线(含V--PH曲线方程的推导)