Google Earth Engine (GEE) ——矢量转栅格初学者最易犯的错误

简介: Google Earth Engine (GEE) ——矢量转栅格初学者最易犯的错误

我们都知道有时候我们需要对矢量和栅格进行转化,这样做的目的就是为了方便我们影像统一操作或者其它处理。这里我们会用到GEE中的一个矢量转换栅格的函数,通过这个函数我们可以快速的将矢量转化未栅格,但是这里需要注意的是我们需要查看我们的矢量集合是否会有很多细节,也就是节点比较多,如果太多的话转换过程会很困难,有时候会出现超限的情况,这里建议在转换前大区域复杂的矢量集合需要进行simply进行简化,这样就可以了/、

reduceToImage(properties, reducer)

Creates an image from a feature collection by applying a reducer over the selected properties of all the features that intersect each pixel.

通过对与每个像素相交的所有特征的选定属性应用缩减器,从特征集合创建图像。

Arguments:

this:collection (FeatureCollection):

Feature collection to intersect with each output pixel.

properties (List):

Properties to select from each feature and pass into the reducer.

reducer (Reducer):

A Reducer to combine the properties of each intersecting feature into a final result to store in the pixel.

Returns: Image

 

simplify(maxError, proj)

Simplifies the geometry of a feature to within a given error margin. Note that this does not respect the error margin requested by the consumer of this algorithm, unless maxError is explicitly specified to be null.

This overrides the default Earth Engine policy for propagating error margins, so regardless of the geometry accuracy requested from the output, the inputs will be requested with the error margin specified in the arguments to this algorithm. This results in consistent rendering at all zoom levels of a rendered vector map, but at lower zoom levels (i.e. zoomed out), the geometry won't be simplified, which may harm performance.

将特征的几何简化到给定的误差范围内。 请注意,这不考虑该算法的使用者请求的误差幅度,除非 maxError 明确指定为 null。

这会覆盖用于传播误差范围的默认 Earth Engine 策略,因此无论从输出请求的几何精度如何,都将使用此算法的参数中指定的误差范围来请求输入。 这会导致在渲染矢量图的所有缩放级别上呈现一致的渲染,但在较低的缩放级别(即缩小)下,几何图形不会被简化,这可能会损害性能。

 

Arguments:

this:feature (Element):

The feature whose geometry is being simplified.

maxError (ErrorMargin):

The maximum amount of error by which the result may differ from the input.

proj (Projection, default: null):

If specified, the result will be in this projection. Otherwise it will be in the same projection as the input. If the error margin is in projected units, the margin will be interpreted as units of this projection

Returns: Feature

原始代码:

var feat_col = ee.FeatureCollection('users/spotter/fire_cnn/buffered_polys/2015')
print(feat_col.first())
Map.addLayer(feat_col, {}, 'Features ')
var img  =  feat_col.reduceToImage({
    properties: ['Year'],
    reducer: ee.Reducer.mean()
    })
    
print(img)
Map.addLayer(img, {}, 'Image')

错误代码:

var img  =  feat_col.reduceToImage({
    properties: ["Date",'Day',"ID","Month",'Year',"count","label"],
    reducer: ee.Reducer.mean()
    })
    
print(img)

另外一个错误就是不能进行多个属性赋值转化,只能选择单个属性进行转化

另外如果遇到转化影像的过程出现了只能转化其中一个的时候,我们需要在本地将矢量集合进行合并,然后再上传,这样就可以进行完整的矢量转栅格了。

相关文章
|
3月前
|
数据可视化 定位技术 Sentinel
如何用Google Earth Engine快速、大量下载遥感影像数据?
【2月更文挑战第9天】本文介绍在谷歌地球引擎(Google Earth Engine,GEE)中,批量下载指定时间范围、空间范围的遥感影像数据(包括Landsat、Sentinel等)的方法~
663 0
如何用Google Earth Engine快速、大量下载遥感影像数据?
|
3月前
|
机器学习/深度学习 算法 数据可视化
基于Google Earth Engine云平台构建的多源遥感数据森林地上生物量AGB估算模型含生物量模型应用APP
基于Google Earth Engine云平台构建的多源遥感数据森林地上生物量AGB估算模型含生物量模型应用APP
112 0
|
2月前
|
存储 编解码 数据可视化
Google Earth Engine获取随机抽样点并均匀分布在栅格的不同数值区中
【2月更文挑战第14天】本文介绍在谷歌地球引擎(Google Earth Engine,GEE)中,按照给定的地表分类数据,对每一种不同的地物类型,分别加以全球范围内随机抽样点自动批量选取的方法~
274 0
Google Earth Engine获取随机抽样点并均匀分布在栅格的不同数值区中
|
3月前
|
API Go 网络架构
GEE Colab——如何从本地/Google云盘/Google Cloud Storage (GCS)上传和下载
GEE Colab——如何从本地/Google云盘/Google Cloud Storage (GCS)上传和下载
101 4
|
3月前
|
机器学习/深度学习 存储 人工智能
GEE Colab——初学者福音快速入门 Google Colab(Colaboratory)
GEE Colab——初学者福音快速入门 Google Colab(Colaboratory)
79 3
|
3月前
|
编解码 人工智能 算法
Google Earth Engine——促进森林温室气体报告的全球时间序列数据集
Google Earth Engine——促进森林温室气体报告的全球时间序列数据集
33 0
|
3月前
|
编解码 人工智能 数据库
Google Earth Engine(GEE)——全球道路盘查项目全球道路数据库
Google Earth Engine(GEE)——全球道路盘查项目全球道路数据库
48 0
|
3月前
|
编解码
Open Google Earth Engine(OEEL)——matrixUnit(...)中产生常量影像
Open Google Earth Engine(OEEL)——matrixUnit(...)中产生常量影像
23 0
|
3月前
Google Earth Engine(GEE)——导出指定区域的河流和流域范围
Google Earth Engine(GEE)——导出指定区域的河流和流域范围
51 0
|
3月前
|
传感器 编解码 数据处理
Open Google Earth Engine(OEEL)——哨兵1号数据的黑边去除功能附链接和代码
Open Google Earth Engine(OEEL)——哨兵1号数据的黑边去除功能附链接和代码
25 0