当前位置:网站首页>Gee: create a new feature and set corresponding attributes
Gee: create a new feature and set corresponding attributes
2022-07-04 01:05:00 【Gee water ecological space】
Although patience and persistence is a painful thing, but it can gradually bring you good.—— Ovid
Patience and persistence are painful things , But it can gradually bring you benefits .—— Ovid
One 、 problem
Earth Engine One of them Feature Is defined as GeoJSON features . say concretely ,a Feature Yes. geometry Storage Geometry object ( or null) Of properties Attributes and objects that store attributes of other attribute dictionaries .
But how in GEE Create a Feature, And assign corresponding attributes to it ?
Two 、 Function and usage
- ee.Feature()
3、 ... and 、 Examples of operation
1、 Create an empty Feature
python The code is as follows :
# Feature Unwanted a Geometry And you can simply wrap an attribute dictionary
# This situation can be applied to the analysis of data , Creating features in this way is important for exporting
# have Dictionary result ( for example image.reduceRegion()) Long running calculations of are very useful .
dict = {'foo':ee.Number(8).add(88), 'bar':'nihao'}
numFeature = ee.Feature(None, dict)
numFeature.getInfo()
2、 Create a Geometry And attribute Feature
python The code is as follows :
# Earth Engine Medium AFeature Is defined as GeoJSON features . say concretely ,aFeature Yes. geometry Storage Geometry object ( or null) Of properties Attributes and objects that store attributes of other attribute dictionaries .
# To create a a Feature, Please provide the constructor Geometry and ( Optional ) Dictionary of other attributes
polygon = ee.Geometry.Polygon([[-35, -10], [35, -10], [35, 10], [-35, 10], [-35, -10]])
polyFeature = ee.Feature(polygon, {'foo':42, 'bar':'tart'})
Map = geemap.Map()
Map.addLayer(polyFeature, {}, 'Feature')
Map
give the result as follows :
3、 by Feature Add attributes and queries
python The code is as follows :
# Every Feature There is one. Geometry Stored in geometry The master node in the attribute . Other geometry can be stored in other attributes .
# Geometry There are also methods such as intersections and buffers , Feature To facilitate access to the main object Geometry, Apply the operation and set the result to the new main object Geometry.
# The result will be preserved Feature Call all other properties of this method . There are also some ways to get and set Feature.
feature = ee.Feature(ee.Geometry.Point([-122.22599, 37.17605])) \
.set('genus', 'Pine') \
.set('species', 'Green')
prop1 = feature.get('species')
print(prop1.getInfo())
# Set new properties
feature = feature.set('presence', 1)
prop2 = feature.get('presence')
print(prop2.getInfo())
Four 、 Summary
- utilize ee.Feature() It can be easily realized Feature The creation of , use set Method to add the attribute dictionary to the attribute , utilize get() Method to query the corresponding attribute
- You need to understand how to create an empty Feature Methods , Use this method to combine ee.reduceRegion() It can flexibly realize the processing and analysis of time series results .
Reference resources :
- https://developers.google.com/earth-engine/apidocs/ee-feature?hl=en
- https://developers.google.com/earth-engine/guides/features
- https://github.com/giswqs/earthengine-py-notebooks/blob/master/FeatureCollection/creating_feature.ipynb
边栏推荐
- Technical practice online fault analysis and solutions (Part 1)
- 【.NET+MQTT】.NET6 环境下实现MQTT通信,以及服务端、客户端的双边消息订阅与发布的代码演示
- Delete all elements with a value of Y. The values of array elements and y are entered by the main function through the keyboard.
- HR disgusted interview behavior
- All in one 1412: binary classification
- Is it really possible that the monthly salary is 3K and the monthly salary is 15K?
- AI helps make new breakthroughs in art design plagiarism retrieval! Professor Liu Fang's team paper was employed by ACM mm, a multimedia top-level conference
- Optimization of for loop
- Alibaba test engineer with an annual salary of 500000 shares notes: a complete set of written tests of software testing
- 12. Go implementation of integer to Roman numeral and leetcode
猜你喜欢
What is the future of software testing industry? Listen to the test veterans' answers
Windos10 reinstallation system tutorial
Avoid playing with super high conversion rate in material minefields
Employees' turnover intention is under the control of the company. After the dispute, the monitoring system developer quietly removed the relevant services
On the day when 28K joined Huawei testing post, I cried: everything I have done in these five months is worth it
[prefix and notes] prefix and introduction and use
2-Redis架构设计到使用场景-四种部署运行模式(下)
The super fully automated test learning materials sorted out after a long talk with a Tencent eight year old test all night! (full of dry goods
Pytest unit test framework: simple and easy to use parameterization and multiple operation modes
Introduction to unity shader essentials reading notes Chapter III unity shader Foundation
随机推荐
技術實踐|線上故障分析及解决方法(上)
All in one 1407: stupid monkey
Is the account opening of Guoyuan securities really safe and reliable
The first training of wechat applet
MySQL uses the view to report an error, explain/show can not be issued; lacking privileges for underlying table
Oracle database knowledge points that cannot be learned (II)
手机异步发送短信验证码解决方案-Celery+redis
It is worthy of "Alibaba internal software test interview notes" from beginning to end, all of which are essence
It's OK to have hands-on 8 - project construction details 3-jenkins' parametric construction
在寻求人类智能AI的过程中,Meta将赌注押向了自监督学习
求esp32C3板子连接mssql方法
Delete all elements with a value of Y. The values of array elements and y are entered by the main function through the keyboard.
2022 Software Test Engineer skill list, please check
基于.NetCore开发博客项目 StarBlog - (14) 实现主题切换功能
A malware detection method for checking PLC system using satisfiability modulus theoretical model
Query efficiency increased by 10 times! Three optimization schemes to help you solve the deep paging problem of MySQL
[software testing] you haven't mastered these real interview questions of big companies?
Pratique technique | analyse et solution des défaillances en ligne (Partie 1)
Introduction to thread pool
老姜的特点