当前位置:网站首页>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 .
边栏推荐
- 消息队列与快递柜之间妙不可言的关系
- ./ setup. Insufficient sh permission
- It's no exaggeration to say that this is the most user-friendly basic tutorial of pytest I've ever seen
- Database daily question --- day 22: last login
- 14、 Two methods of database export and import
- Quelles sont les similitudes et les différences entre les communautés intelligentes et les villes intelligentes?
- Wechat forum exchange applet system graduation design completion (1) development outline
- Guessing game (read data from file)
- Dynamics 365 查找字段过滤
- Personal statement of testers from Shuangfei large factory: is education important for testers?
猜你喜欢

Personal statement of testers from Shuangfei large factory: is education important for testers?

【测试面试题】页面很卡的原因分析及解决方案

JMeter-接口自动化测试读取用例,执行并结果回写

Brush question 4

微信论坛交流小程序系统毕业设计毕设(1)开发概要

ArcGIS:字段赋值_属性表字段计算器(Field Calculator)依据条件为字段赋值

ArcGIS:矢量要素相同字段属性融合的两种方法

V20变频器手自动切换(就地远程切换)的具体方法示例

Why is network i/o blocked?

GEE(四):计算两个变量(影像)之间的相关性并绘制散点图
随机推荐
每日一题——PAT乙级1002题
Years of summary, some core suggestions for learning programming
网络安全-sqlmap与DVWA爆破
Brush question 5
数据库每日一题---第22天:最后一次登录
微信论坛交流小程序系统毕业设计毕设(7)中期检查报告
Bit operation
数字藏品加速出圈,MarsNFT助力多元化文旅经济!
Sword finger offer 55 - I. depth of binary tree
今日创见|企业促进创新的5大关键要素
Develop those things: go plus c.free to free memory, and what are the reasons for compilation errors?
JMeter interface automated test read case, execute and write back result
Network security sqlmap and DVWA explosion
Why does the market need low code?
Circumvention Technology: Registry
Introduction to anomaly detection
[untitled] reprint melting ice - track icedid server with a few simple steps
十四、数据库的导出和导入的两种方法
PMP项目管理考试过关口诀-1
Software test classification