当前位置:网站首页>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 .
边栏推荐
- Classification and prediction of heartbeat signal
- Two minutes, talk about some wrong understandings of MySQL index
- The wonderful relationship between message queue and express cabinet
- DTC社群运营怎么做?
- Unity and webgl love each other
- Quelles sont les similitudes et les différences entre les communautés intelligentes et les villes intelligentes?
- 网络安全-钓鱼
- Cascade-LSTM: A Tree-Structured Neural Classifier for Detecting Misinformation Cascades-KDD2020
- 聊聊 Dart 的空安全 (null safety) 特性
- 网格(Grid)
猜你喜欢

一次搞明白 Session、Cookie、Token,面试问题全稿定

Interview questions: how to test app performance?

十四、数据库的导出和导入的两种方法

PMP项目管理考试过关口诀-1

Transform XL translation

The author of LinkedList said he didn't use LinkedList himself

微生物健康網,如何恢複微生物群落

Cases of agile innovation and transformation of consumer goods enterprises

iNFTnews | Web5 vs Web3:未来是一个过程,而不是目的地

PCL . VTK files and Mutual conversion of PCD
随机推荐
Sword finger offer 55 - I. depth of binary tree
位运算(Bit Operation)
Sword finger offer 28 Symmetric binary tree
It's no exaggeration to say that this is the most user-friendly basic tutorial of pytest I've ever seen
Microbial Health Network, How to restore Microbial Communities
十三、系统优化
CTF exercise
Introduction to anomaly detection
网络安全-sqlmap与DVWA爆破
Software test classification
There is another problem just online... Warm
Transform XL translation
Installing vmtools is gray
一次搞明白 Session、Cookie、Token,面试问题全稿定
聊聊 Dart 的空安全 (null safety) 特性
二叉树(Binary Tree)
Mitsubishi PLC SLmP (MC) protocol
线上面试,该如何更好的表现自己?这样做,提高50%通过率~
Network security -burpsuit
网络安全-安装CentOS