当前位置:网站首页>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 .
边栏推荐
- V20变频器手自动切换(就地远程切换)的具体方法示例
- About idea cannot find or load the main class
- Sword finger offer 63 Maximum profit of stock
- I wish you all the best and the year of the tiger
- Line test - graphic reasoning -7- different graphic classes
- GBU1510-ASEMI电源专用15A整流桥GBU1510
- Mitsubishi PLC SLmP (MC) protocol
- 消息队列与快递柜之间妙不可言的关系
- 小程序多种开发方式对比-跨端?低代码?原生?还是云开发?
- Microbial Health Network, How to restore Microbial Communities
猜你喜欢
微信论坛交流小程序系统毕业设计毕设(5)任务书
Lecture 30 linear algebra Lecture 5 eigenvalues and eigenvectors
消息队列与快递柜之间妙不可言的关系
数据库每日一题---第22天:最后一次登录
Cascade-LSTM: A Tree-Structured Neural Classifier for Detecting Misinformation Cascades-KDD2020
ArcGIS:矢量要素相同字段属性融合的两种方法
There is another problem just online... Warm
聊聊 Dart 的空安全 (null safety) 特性
微信论坛交流小程序系统毕业设计毕设(1)开发概要
Unity与WebGL的相爱相杀
随机推荐
Cascade-LSTM: A Tree-Structured Neural Classifier for Detecting Misinformation Cascades-KDD2020
What is ADC sampling rate (Hz) and how to calculate it
数据库每日一题---第22天:最后一次登录
聊聊 Dart 的空安全 (null safety) 特性
GEE(四):计算两个变量(影像)之间的相关性并绘制散点图
There is another problem just online... Warm
Unity and webgl love each other
Network security sqlmap and DVWA explosion
ADC采样率(HZ)是什么怎么计算
Understand the session, cookie and token at one time, and the interview questions are all finalized
为什么市场需要低代码?
Brush question 3
Years of summary, some core suggestions for learning programming
JMeter-接口自动化测试读取用例,执行并结果回写
每日一题——PAT乙级1002题
Installing vmtools is gray
Statistical method for anomaly detection
2021-01-12
Advantages and disadvantages of rest ful API
Gbu1510-asemi power supply special 15A rectifier bridge gbu1510