前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Google Earth Engine(GEE)——如何加载ee.FeatureCollection中点数据在MAP中

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

作者头像
此星光明
发布2024-02-02 10:55:48
1730
发布2024-02-02 10:55:48
举报

遇到粉丝问这样的问题,如何加载矢量集合中的点数据在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
代码语言:javascript
复制
var geometry = 
    /* color: #98ff00 */
    /* displayProperties: [
      {
        "type": "rectangle"
      }
    ] */
    ee.Geometry.Polygon(
        [[[-113.3658081828087, 41.45685505178655],
          [-113.3658081828087, 40.134503279488],
          [-110.0039917765587, 40.134503279488],
          [-110.0039917765587, 41.45685505178655]]], null, false);


// 设置数据时间
var startDate = ee.Date.fromYMD(2018,1,1);
var endDate = ee.Date.fromYMD(2019,1,1);
 
// 获取地表温度
var temperature = ee.ImageCollection("MODIS/006/MOD11A2")
  .filterDate(startDate, endDate)
  .select('LST_Day_1km')
  .mean()
 
// 抽取N个点
var values = temperature.sample({ region: geometry, scale: 500, numPixels: 1000, geometries: true}) 
 
//这里主要是为了让大家看清楚我展示确实是矢量集合
var xx = ee.FeatureCollection(values)
//加载点数据
Map.addLayer(xx.style({ color: 'green', pointSize: 3 }), {}, 'samples1')
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2024-02-01,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Arguments:
  • Returns: FeatureCollection
  • Arguments:
  • Returns: ui.Map.Layer
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档