日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

arcpy利用XY创建点

發(fā)布時間:2023/12/10 编程问答 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 arcpy利用XY创建点 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

參考了很多博客吧,最后把自己都改蒙了,這個博客有分析arcpy創(chuàng)建帶高程的點圖層、

# -*- 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创建点的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。