当前位置:网站首页>Arcpy为矢量数据添加字段与循环赋值
Arcpy为矢量数据添加字段与循环赋值
2022-04-23 05:46:00 【今天学习要很快乐鸭】
Arcpy为矢量数据添加字段与循环修改值或赋值
如题目所示,已经生成的Arcmap矢量属性表里对于赋值一些简单的操作时是可以的,但是想添加Excel表格里的一列新数据则需要使用Arcpy的游标来处理。可以提前在Arcmap里建好字段,或者直接新建字段:
#coding:utf-8
import arcpy
import numpy as np
filename = r'E:\bjdata\data'
arcpy.env.workspace = filename
# path = r"E:\bjdata\result(1000,15).xlsx"
path = r"C:\Users\mianmian\Desktop\result.csv"
wdata=np.genfromtxt(path,delimiter=",") # 打开Excel文件
x=wdata[:,13]; #第13列,所有行数据
# print(x)
shp_path = r'E:\bjdata\rightbjnet.shp'
cursor = arcpy.UpdateCursor(shp_path)
i = 1
for my_row in cursor:
my_value = my_row.getValue('result')
# print(my_value)
my_row.setValue('result', float(x[i]))
cursor.updateRow(my_row)
i += 1
print(my_value)
版权声明
本文为[今天学习要很快乐鸭]所创,转载请带上原文链接,感谢
https://blog.csdn.net/ShirleyLGY/article/details/115529479
边栏推荐
- PHP processing JSON_ Decode() parses JSON stringify
- 1. Calculate a + B
- SQL optimization best practices
- RPC must know and know
- ThreadLocal. Threadlocalmap analysis
- Conversion between JS object and string
- Addition, deletion, modification and query of MySQL table
- GNU EFI header file
- 11.a==b?
- Plane semi intersecting plate
猜你喜欢

Understanding and installing MySQL

Advanced operation of idea debug

Import of data

Detection technology and principle

Generate excel template (drop-down selection, multi-level linkage)

20 excellent plug-ins recommended by idea

Explanation of the second I interval of 2020 Niuke summer multi school training camp

St table template

Algèbre linéaire chapitre 1 - déterminants

List segmentation best practices
随机推荐
Introduction to virtualization features
[transfer] MySQL: how many rows of data can InnoDB store in a B + tree?
批量导出Arcgis属性表
程序設計訓練
[untitled] database - limit the number of returned rows
Miscellaneous 1
Cf515b drazil and his happy friends
10.Advance Next Round
The problem that the page will refresh automatically after clicking the submit button on the form is solved
Robocode教程4——Robocode的游戏物理
队列解决约瑟夫问题
-- SQL query and return limit rows
1007 go running (hdu6808) in the fourth game of 2020 Hangzhou Electric Multi school competition
Stability building best practices
Addition, deletion, modification and query of MySQL table
LockSupport. Park and unpark, wait and notify
Customized communication between threads (reentrantlock)
MySQL best practices for creating tables
@Problems caused by internal dead loop of postconstruct method
Rainbow (DP)