当前位置:网站首页>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')
Mapgive 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
边栏推荐
- 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
- Introduction to unity shader essentials reading notes Chapter III unity shader Foundation
- Is the account opening of Guoyuan securities really safe and reliable
- [cloud native topic -48]:kubesphere cloud Governance - operation - overview of multi tenant concept
- A-Frame虚拟现实开发入门
- Generic
- In the process of seeking human intelligent AI, meta bet on self supervised learning
- 【.NET+MQTT】. Net6 environment to achieve mqtt communication, as well as bilateral message subscription and publishing code demonstration of server and client
- 功能:将主函数中输入的字符串反序存放。例如:输入字符串“abcdefg”,则应输出“gfedcba”。
- PMP 考试常见工具与技术点总结
猜你喜欢

Data mining vs Machine Learning: what is the difference between them? Which is more suitable for you to learn

功能:求出菲波那契数列的前一项与后一项之比的极限的 近似值。例如:当误差为0.0001时,函数值为0.618056。

How to be a professional software testing engineer? Listen to the byte five year old test
![[error record] configure NDK header file path in Visual Studio (three header file paths of NDK | ASM header file path selection related to CPU architecture)](/img/44/aa4963d07d046deb2bc76eb59f8ff7.jpg)
[error record] configure NDK header file path in Visual Studio (three header file paths of NDK | ASM header file path selection related to CPU architecture)

技术实践|线上故障分析及解决方法(上)

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,

Print diamond pattern

Software testers, how can you quickly improve your testing skills? Ten minutes to teach you

I don't care about you. OKR or KPI, PPT is easy for you

Sequence list and linked list
随机推荐
机器学习基础:用 Lasso 做特征选择
长文综述:大脑中的熵、自由能、对称性和动力学
Network layer - routing
What is the GPM scheduler for go?
手机异步发送短信验证码解决方案-Celery+redis
The FISCO bcos console calls the contract and reports an error does not exist
What insurance products should be bought for the elderly?
Employees' turnover intention is under the control of the company. After the dispute, the monitoring system developer quietly removed the relevant services
be based on. NETCORE development blog project starblog - (14) realize theme switching function
Fundamentals of machine learning: feature selection with lasso
Future源码一观-JUC系列
技术实践|线上故障分析及解决方法(上)
In the process of seeking human intelligent AI, meta bet on self supervised learning
Generic
[error record] configure NDK header file path in Visual Studio
国元证券开户是真的安全可靠吗
Function: store the strings entered in the main function in reverse order. For example, if you input the string "ABCDEFG", you should output "gfedcba".
老姜的特点
Summary of common tools and technical points of PMP examination
“疫”起坚守 保障数据中台服务“不打烊”