当前位置:网站首页>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
边栏推荐
- be based on. NETCORE development blog project starblog - (14) realize theme switching function
- Is it really possible that the monthly salary is 3K and the monthly salary is 15K?
- Thinkphp6 integrated JWT method and detailed explanation of generation, removal and destruction
- Future源码一观-JUC系列
- be based on. NETCORE development blog project starblog - (14) realize theme switching function
- 2022 Software Test Engineer skill list, please check
- Alibaba test engineer with an annual salary of 500000 shares notes: a complete set of written tests of software testing
- The difference between fetchtype lazy and eagle in JPA
- 7.1 learning content
- The difference between objects and objects
猜你喜欢

2-redis architecture design to use scenarios - four deployment and operation modes (Part 2)

Sorry, Tencent I also refused

0 basic learning C language - nixie tube dynamic scanning display

What is the future of software testing industry? Listen to the test veterans' answers

Query efficiency increased by 10 times! Three optimization schemes to help you solve the deep paging problem of MySQL

Sequence list and linked list

The FISCO bcos console calls the contract and reports an error does not exist

Unity Shader入门精要读书笔记 第三章 Unity Shader基础

Long article review: entropy, free energy, symmetry and dynamics in the brain

Network layer - routing
随机推荐
A malware detection method for checking PLC system using satisfiability modulus theoretical model
[prefix and notes] prefix and introduction and use
Att & CK actual combat series - red team actual combat - V
GUI 应用:socket 网络聊天室
技术实践|线上故障分析及解决方法(上)
Pair
Cloud dial test helps Weidong cloud education to comprehensively improve the global user experience
It's OK to have hands-on 8 - project construction details 3-jenkins' parametric construction
Gauss elimination method and template code
长文综述:大脑中的熵、自由能、对称性和动力学
【.NET+MQTT】.NET6 环境下实现MQTT通信,以及服务端、客户端的双边消息订阅与发布的代码演示
Wechat official account and synchronization assistant
[software testing] you haven't mastered these real interview questions of big companies?
Future源码一观-JUC系列
How to be a professional software testing engineer? Listen to the byte five year old test
Weekly open source project recommendation plan
All in one 1407: stupid monkey
Future source code view -juc series
【.NET+MQTT】. Net6 environment to achieve mqtt communication, as well as bilateral message subscription and publishing code demonstration of server and client
The culprit of unrestrained consumption -- Summary