当前位置:网站首页>ArcGIS: field assignment_ The attribute table field calculator assigns values to fields based on conditions
ArcGIS: field assignment_ The attribute table field calculator assigns values to fields based on conditions
2022-07-07 23:12:00 【BetterQ.】
When the ArcGIS When assigning values to fields in the attribute table of the data loaded in , You can click on the “ Start editing ” Then assign values to fields manually , But when the amount of data is large, you need to use Python To assign a value to it .
After opening the property sheet , Click on the field to be assigned , Right click to select “ Field calculator ”, Here's the picture :
Direct unified assignment :
Directly enter numbers or letters or text in the input box to assign a unified value to this field .
.
.
Assignment by condition :
When conditional assignment is required , You can enter the following script to :
.
def cal(f)
if f=='s':
return 1
if f=='a':
return 2
else:
return 99
If you need to assign a value to the field according to the size of the value, you can enter the following code :
def cal(f)
if f>50:
return 1
if f<100 and f>60:
return 2
else:
return 99
Be careful :
1、 Because of the use of python To write , So pay special attention to spaces and alignment , Generally indented 4 individual /8 A space , But sometimes it is 3 individual /7 A space . Problems usually occur because the space is indented incorrectly .
2、 When using words , It needs to be transcoded , To utf-8 The format can be recognized , as follows :
def cal(f)
if f==(' The grass '.decode(utf-8)):
return 1
if f==(' Woodland '.decode(utf-8)):
return 2
else:
return ' other '.decode(utf-8)
3、 Don't forget it if Add a colon to the back , And all are colons in English .
边栏推荐
- 嵌入式音频开发中的两种曲线
- 每日一题——PAT乙级1002题
- Classification and prediction of heartbeat signal
- 微信论坛交流小程序系统毕业设计毕设(5)任务书
- Network security - information query of operating system
- PMP项目管理考试过关口诀-1
- 线上面试,该如何更好的表现自己?这样做,提高50%通过率~
- Develop those things: go plus c.free to free memory, and what are the reasons for compilation errors?
- U盘拷贝东西时,报错卷错误,请运行chkdsk
- Cascade-LSTM: A Tree-Structured Neural Classifier for Detecting Misinformation Cascades-KDD2020
猜你喜欢
CTF exercise
数字藏品加速出圈,MarsNFT助力多元化文旅经济!
Line test - graphic reasoning -7- different graphic classes
Use JfreeChart to generate curves, histograms, pie charts, and distribution charts and display them to jsp-2
GBU1510-ASEMI电源专用15A整流桥GBU1510
Wechat forum exchange applet system graduation design completion (4) opening report
数据库每日一题---第22天:最后一次登录
PCL .vtk文件与.pcd的相互转换
iNFTnews | Web5 vs Web3:未来是一个过程,而不是目的地
Microbial health network, how to restore microbial communities
随机推荐
Network security - information query of operating system
聊聊 Dart 的空安全 (null safety) 特性
【测试面试题】页面很卡的原因分析及解决方案
ADC采样率(HZ)是什么怎么计算
网络安全-安装CentOS
Transform XL translation
安踏DTC | 安踏转型,构建不只有FILA的增长飞轮
2022 words for yourself
Locate to the bottom [easy to understand]
Personal statement of testers from Shuangfei large factory: is education important for testers?
leetcode-520. 检测大写字母-js
It's no exaggeration to say that this is the most user-friendly basic tutorial of pytest I've ever seen
Sword finger offer 63 Maximum profit of stock
JMeter interface automated test read case, execute and write back result
Txt file virus
Advantages and disadvantages of rest ful API
U盘拷贝东西时,报错卷错误,请运行chkdsk
GBU1510-ASEMI电源专用15A整流桥GBU1510
PMP project management exam pass Formula-1
知识点滴 - PCB制造工艺流程