当前位置:网站首页>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 .
边栏推荐
- Mitsubishi PLC SLmP (MC) protocol
- Brush question 6
- 微生物健康網,如何恢複微生物群落
- iNFTnews | NFT技术的广泛应用及其存在的问题
- Software evaluation center ▏ what are the basic processes and precautions for automated testing?
- 为什么市场需要低代码?
- About idea cannot find or load the main class
- Brush question 4
- Grid
- There is another problem just online... Warm
猜你喜欢

Digital collections accelerated out of the circle, and marsnft helped diversify the culture and tourism economy!

I wish you all the best and the year of the tiger

Are the microorganisms in the intestines the same as those on the skin?

Innovation today | five key elements for enterprises to promote innovation

Sword finger offer 27 Image of binary tree

Wechat forum exchange applet system graduation design completion (4) opening report

二叉树(Binary Tree)

【微服务|SCG】gateway整合sentinel

What does the model number of asemi rectifier bridge kbpc1510 represent

JMeter-接口自动化测试读取用例,执行并结果回写
随机推荐
Database daily question --- day 22: last login
【刷题记录】3. 无重复字符的最长子串
线上面试,该如何更好的表现自己?这样做,提高50%通过率~
QT graphicsview graphical view usage summary with flow chart development case prototype
CTF exercise
DTC社群运营怎么做?
V20变频器手自动切换(就地远程切换)的具体方法示例
Brush question 5
JS triangle
Sword finger offer 55 - I. depth of binary tree
PCL . VTK files and Mutual conversion of PCD
Txt file virus
微信论坛交流小程序系统毕业设计毕设(4)开题报告
What does the model number of asemi rectifier bridge kbpc1510 represent
Talk about DART's null safety feature
Personal statement of testers from Shuangfei large factory: is education important for testers?
PCL .vtk文件与.pcd的相互转换
关于海康ipc的几个参数
网络安全-sqlmap与DVWA爆破
网络安全-CSRF