当前位置:网站首页>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
边栏推荐
- [software testing] you haven't mastered these real interview questions of big companies?
- 不得不会的Oracle数据库知识点(四)
- Force deduction solution summary 1189- maximum number of "balloons"
- Delete all elements with a value of Y. The values of array elements and y are entered by the main function through the keyboard.
- Data mining vs Machine Learning: what is the difference between them? Which is more suitable for you to learn
- MySQL -- Introduction and use of single line functions
- Function: find the sum of the elements on the main and sub diagonal of the matrix with 5 rows and 5 columns. Note that the elements where the two diagonals intersect are added only once. For example,
- Query efficiency increased by 10 times! Three optimization schemes to help you solve the deep paging problem of MySQL
- The difference between objects and objects
- PMP 考试常见工具与技术点总结
猜你喜欢
GUI application: socket network chat room
机器学习基础:用 Lasso 做特征选择
A malware detection method for checking PLC system using satisfiability modulus theoretical model
Cloud dial test helps Weidong cloud education to comprehensively improve the global user experience
Technical practice online fault analysis and solutions (Part 1)
Alibaba test engineer with an annual salary of 500000 shares notes: a complete set of written tests of software testing
I don't care about you. OKR or KPI, PPT is easy for you
“疫”起坚守 保障数据中台服务“不打烊”
OS interrupt mechanism and interrupt handler
[cloud native topic -48]:kubesphere cloud Governance - operation - overview of multi tenant concept
随机推荐
Technical practice online fault analysis and solutions (Part 1)
[software testing] you haven't mastered these real interview questions of big companies?
Introduction to A-frame virtual reality development
Optimization of for loop
Employees' turnover intention is under the control of the company. After the dispute, the monitoring system developer quietly removed the relevant services
Oracle database knowledge points (I)
Summary of common tools and technical points of PMP examination
1-redis architecture design to use scenarios - four deployment and operation modes (Part 1)
swagger中响应参数为Boolean或是integer如何设置响应描述信息
Release and visualization of related data
基于.NetCore开发博客项目 StarBlog - (14) 实现主题切换功能
The FISCO bcos console calls the contract and reports an error does not exist
Leetcode 121 best time to buy and sell stock (simple)
For loop
Oracle database knowledge points that cannot be learned (II)
Avoid playing with super high conversion rate in material minefields
Att & CK actual combat series - red team actual combat - V
Function: find the sum of the elements on the main and sub diagonal of the matrix with 5 rows and 5 columns. Note that the elements where the two diagonals intersect are added only once. For example,
Function: find the approximate value of the limit of the ratio of the former term to the latter term of Fibonacci sequence. For example, when the error is 0.0001, the function value is 0.618056.
PMP 考试常见工具与技术点总结