Google Earth Engine(GEE)——如何加载ee.FeatureCollection中点数据在MAP中

举报
此星光明 发表于 2022/04/16 01:14:56 2022/04/16
【摘要】 遇到粉丝问这样的问题,如何加载矢量集合中的点数据在map地图中,其实这是一个非常简单的问题。首先我们要先有一个矢量集合,其次我们就直接用Map.addlayer就OK了。本次我asset中没有矢量集合点,所以我利用随机点生成一些点,作为我的矢量集合。 先来看两个函数:这里我不翻译了,大家应该都能看懂 ee.FeatureCollec...

遇到粉丝问这样的问题,如何加载矢量集合中的点数据在map地图中,其实这是一个非常简单的问题。首先我们要先有一个矢量集合,其次我们就直接用Map.addlayer就OK了。本次我asset中没有矢量集合点,所以我利用随机点生成一些点,作为我的矢量集合。

先来看两个函数:这里我不翻译了,大家应该都能看懂

ee.FeatureCollection(args, column)

FeatureCollections can be constructed from the following arguments:

- A string: assumed to be the name of a collection.

- A single geometry.

- A single feature.

- A list of features.

- A GeoJSON FeatureCollection

- A computed object: reinterpreted as a collection.

Arguments:

args (ComputedObject|Feature|FeatureCollection|Geometry|List<Object>|Number|String):

The constructor arguments.

column (String, optional):

The name of the geometry column to use. Only useful when working with a named collection.

Returns: FeatureCollection

Map.addLayer(eeObject, visParamsnameshownopacity)

Adds a given EE object to the map as a layer.

Returns the new map layer.

Arguments:

eeObject (Collection|Feature|Image|RawMapId):

The object to add to the map.

visParams (FeatureVisualizationParameters|ImageVisualizationParameters, optional):

The visualization parameters. For Images and ImageCollection, see ee.data.getMapId for valid parameters. For Features and FeatureCollections, the only supported key is "color", as a CSS 3.0 color string or a hex string in "RRGGBB" format. Ignored when eeObject is a map ID.

name (String, optional):

The name of the layer. Defaults to "Layer N".

shown (Boolean, optional):

A flag indicating whether the layer should be on by default.

opacity (Number, optional):

The layer's opacity represented as a number between 0 and 1. Defaults to 1.

Returns: ui.Map.Layer


  
  1. var geometry =
  2. /* color: #98ff00 */
  3. /* displayProperties: [
  4. {
  5. "type": "rectangle"
  6. }
  7. ] */
  8. ee.Geometry.Polygon(
  9. [[[-113.3658081828087, 41.45685505178655],
  10. [-113.3658081828087, 40.134503279488],
  11. [-110.0039917765587, 40.134503279488],
  12. [-110.0039917765587, 41.45685505178655]]], null, false);
  13. // 设置数据时间
  14. var startDate = ee.Date.fromYMD(2018,1,1);
  15. var endDate = ee.Date.fromYMD(2019,1,1);
  16. // 获取地表温度
  17. var temperature = ee.ImageCollection("MODIS/006/MOD11A2")
  18. .filterDate(startDate, endDate)
  19. .select('LST_Day_1km')
  20. .mean()
  21. // 抽取N个点
  22. var values = temperature.sample({ region: geometry, scale: 500, numPixels: 1000, geometries: true})
  23. //这里主要是为了让大家看清楚我展示确实是矢量集合
  24. var xx = ee.FeatureCollection(values)
  25. //加载点数据
  26. Map.addLayer(xx.style({ color: 'green', pointSize: 3 }), {}, 'samples1')

 

文章来源: blog.csdn.net,作者:此星光明2021年博客之星云计算Top3,版权归原作者所有,如需转载,请联系作者。

原文链接:blog.csdn.net/qq_31988139/article/details/121412130

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。