# -*- 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 path
if os.path.isfile(path):
# Set the local variables
outputname = path[40:57]+"_"+path[58:73]+".shp"
print outputname
spatRef = 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")#m
arcpy.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 fc
num=0
for 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 feature
vertex = arcpy.CreateObject("Point")
vertex.X = float(x)
vertex.Y = float(y_coords[num])
feature.shape = vertex
feature.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.speed
cursor.insertRow(feature)
num=num+1
arcpy.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. Oracle Sales Cloud:管理沙盒(定制化)小细节1——利用公式创建字段并显示在前端页面

    Oracle Sales Cloud(Oracle 销售云)是一套基于Oracle云端的CRM管理系统.由于 Oracle 销售云是基于 Oracle 云环境的,它与传统的管理系统相比,显著特点之一便 ...

  2. 利用Oracle创建表空间和用户

    本文仅用于学习交流,商业用途请支持正版!转载请注明:http://www.cnblogs.com/mxbs/p/6217152.html 第一步,创建表空间 以SYS/sys账户和SYSDBA身份登录 ...

  3. 利用Oracle创建数据库

    本文仅用于学习交流,商业用途请支持正版!转载请注明:http://www.cnblogs.com/mxbs/p/6217151.html 数据库的创建 打开"所有程序"-" ...

  4. 利用navicat创建存储过程、触发器和使用游标的简单实例

    利用navicat创建存储过程.触发器和使用游标的简单实例 标签: navicat存储过程触发器mysql游标 2013-08-03 21:34 15516人阅读 评论(1) 收藏 举报  分类: 数 ...

  5. java中利用JFrame创建窗体 【转】

    1. 一个简单的swing public class Test(){ public static void main(String[] args){ JFrame frame = new JFrame ...

  6. IOS:利用dispatch_once创建单例

    在之前有一篇学习笔记中,记载了一篇如何在OC中实现单例的文章:<IOS学习笔记4—Objective C—创建单例>自苹果引入了Grand Central Dispatch (GCD)(M ...

  7. 利用WPF创建含多种交互特性的无边框窗体

    咳咳,标题一口气读下来确实有点累,让我先解释一下.另外文章底部有演示程序的下载. 本文介绍利用WPF创建一个含有以下特性的窗口: 有窗口阴影,比如QQ窗口外围只有几像素的阴影: 支持透明且无边框,为了 ...

  8. 编写利用Fragment创建新闻列表

    编写利用Fragment创建新闻列表 1.创建新闻实体类News,代码如下:   public class News { private String title; private String co ...

  9. 利用cocoapods创建基于git的私有库

    上一篇文章记录了我利用cocoapods创建基于SVN的私有库的全部过程,今天我再记录一下基于git创建的过程. 整体先说明一下创建一个私有的podspec包括如下那么几个步骤: 创建并设置一个私有的 ...

随机推荐

  1. Day1 BFS算法的学习和训练

    ​ 因为自己的原因,之前没有坚持做算法的相应学习,总是觉得太难就半途而废,真的算是一个遗憾了,所以现在开始,定一个30天入门学习算法计划. ​ 我是根据<算法图解>的顺序进行安排的,自己对 ...

  2. OpenMediaVault 搭建git,ssh无法连接问题

    /************************************************************************* * OpenMediaVault 搭建git,ss ...

  3. BZOJ:2819 NIM(树链剖分||DFS序 &&NIM博弈)

    著名游戏设计师vfleaking,最近迷上了Nim.普通的Nim游戏为:两个人进行游戏,N堆石子,每回合可以取其中某一堆的任意多个,可以取完,但不可以不取.谁不能取谁输.这个游戏是有必胜策略的.于是v ...

  4. css 实现元素四角图片样式,元素的大小不定

    demo 效果 css body { margin:; } .popup p{ margin-bottom:20px; margin-left:200px; } .popup p span{ disp ...

  5. jquery操作ID带有变量的节点

    var indexNode='content'+index;$("#"+indexNode).show( 'puff', { }, 500, callback );

  6. 【转载】CAS操作

    [本文转载]http://blog.csdn.net/hsuxu/article/details/9467651 CAS CAS:Compare and Swap, 翻译成比较并交换. java.ut ...

  7. 洛谷P4344 [SHOI2015]脑洞治疗仪(珂朵莉树)

    传送门 看到区间推倒……推平就想到珂朵莉树 挖脑洞直接assign,填坑先数一遍再assign再暴力填,数数的话暴力数 //minamoto #include<iostream> #inc ...

  8. 全选Js

    <th><input type="checkbox" value="" id="checkedAll" onclick=& ...

  9. [转]POJ WA/RE指南

    "POJ上头的题都是数学题",也不知道是那个家伙胡诌的--但是POJ的要求就是算法通过了也不让你AC.下面本人就这560题的经验,浅谈一下WA/RE了怎么办.  以下内容是扯淡-- ...

  10. libcurl在centos6.4 64位操作系统上不支持https的解决方案

    rpm -e –nodeps 软件名 例如: 使用yum install nginx 安装了nginx, 这是如果直接使用yum remove nginx 的话,会把依赖的一些包也删掉, 所以要使用r ...