当前位置:网站首页>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 .
边栏推荐
- 关于海康ipc的几个参数
- GEE(四):计算两个变量(影像)之间的相关性并绘制散点图
- 网络安全-burpsuit
- opencv scalar传入三个参数只能显示黑白灰问题解决
- Wechat forum exchange applet system graduation design completion (4) opening report
- 【测试面试题】页面很卡的原因分析及解决方案
- DTC社群运营怎么做?
- 三菱PLC slmp(mc)协议
- Wechat forum exchange applet system graduation design completion (1) development outline
- Online interview, how to better express yourself? In this way, the passing rate will be increased by 50%~
猜你喜欢
随机推荐
Transform XL translation
网络安全-burpsuit
Redhat下安装fedora
Byte hexadecimal binary understanding
Advantages and disadvantages of rest ful API
opencv scalar传入三个参数只能显示黑白灰问题解决
微信论坛交流小程序系统毕业设计毕设(3)后台功能
The author of LinkedList said he didn't use LinkedList himself
Network security - phishing
Grid
网络安全-安装CentOS
OC variable parameter transfer
Brush question 4
线上面试,该如何更好的表现自己?这样做,提高50%通过率~
微信论坛交流小程序系统毕业设计毕设(8)毕业设计论文模板
Anta DTC | Anta transformation, building a growth flywheel that is not only FILA
[untitled] reprint melting ice - track icedid server with a few simple steps
Network security -burpsuit
定位到最底部[通俗易懂]
知识点滴 - PCB制造工艺流程









