当前位置:网站首页>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 .
边栏推荐
- 微信论坛交流小程序系统毕业设计毕设(6)开题答辩PPT
- 肠道里的微生物和皮肤上的一样吗?
- Why is network i/o blocked?
- oc 可变參数传递
- Network security - phishing
- Brush question 4
- 微信论坛交流小程序系统毕业设计毕设(4)开题报告
- Develop those things: go plus c.free to free memory, and what are the reasons for compilation errors?
- Cases of agile innovation and transformation of consumer goods enterprises
- Comparison of various development methods of applets - cross end? Low code? Native? Or cloud development?
猜你喜欢
消息队列与快递柜之间妙不可言的关系
ASEMI整流桥KBPC1510的型号数字代表什么
微生物健康网,如何恢复微生物群落
Two minutes, talk about some wrong understandings of MySQL index
今日创见|企业促进创新的5大关键要素
Microbial Health Network, How to restore Microbial Communities
iNFTnews | NFT技术的广泛应用及其存在的问题
数据库每日一题---第22天:最后一次登录
Wechat forum exchange applet system graduation design completion (1) development outline
不夸张地说,这是我见过最通俗易懂的,pytest入门基础教程
随机推荐
数据库每日一题---第22天:最后一次登录
The author of LinkedList said he didn't use LinkedList himself
Network security - Eternal Blue
Database daily question --- day 22: last login
OC variable parameter transfer
嵌入式音频开发中的两种曲线
消息队列与快递柜之间妙不可言的关系
双非大厂测试员亲述:对测试员来说,学历重要吗?
2021-01-11
ArcGIS:矢量要素相同字段属性融合的两种方法
GEE(三):计算两个波段间的相关系数与相应的p值
网络安全-安装CentOS
微信论坛交流小程序系统毕业设计毕设(3)后台功能
Knowledge drop - PCB manufacturing process flow
开发那些事儿:Go加C.free释放内存,编译报错是什么原因?
今日创见|企业促进创新的5大关键要素
Understand the session, cookie and token at one time, and the interview questions are all finalized
Wechat forum exchange applet system graduation design completion (1) development outline
Circumvention Technology: Registry
Txt file virus