当前位置:网站首页>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 .
边栏推荐
- Years of summary, some core suggestions for learning programming
- 软件测评中心▏自动化测试有哪些基本流程和注意事项?
- Line measurement - graphic reasoning -9- line problem class
- 双非大厂测试员亲述:对测试员来说,学历重要吗?
- Cascade-LSTM: A Tree-Structured Neural Classifier for Detecting Misinformation Cascades-KDD2020
- Quelles sont les similitudes et les différences entre les communautés intelligentes et les villes intelligentes?
- Sword finger offer 55 - I. depth of binary tree
- 网络安全-beef
- 小程序多种开发方式对比-跨端?低代码?原生?还是云开发?
- U盘拷贝东西时,报错卷错误,请运行chkdsk
猜你喜欢
数字藏品加速出圈,MarsNFT助力多元化文旅经济!
安踏DTC | 安踏转型,构建不只有FILA的增长飞轮
小程序多种开发方式对比-跨端?低代码?原生?还是云开发?
开发那些事儿:Go加C.free释放内存,编译报错是什么原因?
There is another problem just online... Warm
行测-图形推理-1-汉字类
一次搞明白 Session、Cookie、Token,面试问题全稿定
数据库每日一题---第22天:最后一次登录
14、 Two methods of database export and import
Line test - graphic reasoning - 1 - Chinese character class
随机推荐
There is another problem just online... Warm
Gbu1510-asemi power supply special 15A rectifier bridge gbu1510
I wish you all the best and the year of the tiger
Quelles sont les similitudes et les différences entre les communautés intelligentes et les villes intelligentes?
What is fake sharing after filling the previous hole?
Cascade-LSTM: A Tree-Structured Neural Classifier for Detecting Misinformation Cascades-KDD2020
数据库每日一题---第22天:最后一次登录
Wechat forum exchange applet system graduation design completion (1) development outline
Line test graph reasoning graph group class
PCL .vtk文件与.pcd的相互转换
一次搞明白 Session、Cookie、Token,面试问题全稿定
Binary tree
ArcGIS:字段赋值_属性表字段计算器(Field Calculator)依据条件为字段赋值
开发那些事儿:Go加C.free释放内存,编译报错是什么原因?
Network security - joint query injection
30讲 线性代数 第五讲 特征值与特征向量
安踏DTC | 安踏转型,构建不只有FILA的增长飞轮
网络安全-安装CentOS
Brush question 3
网络安全-beef