当前位置: 首页 > news >正文

GEE——土地利用分类种两个矢量集合中不同列进行相减的方式(利用join进行连接处理)

问题:

我有两个具有相同 ID 的特征集,我想从第二个特征集中减去第一个特征集的表格单元格。

我使用了这个函数,但它计算的是表 1 中第一个元素与表 2 中其他元素的减法。

我想逐个单元格计算减法。第一个表格中 id 为 1 的单元格减去第二个表格中 id 为 1 的单元格,2x2、3x3...

有人能帮我完成这项任务吗?
 

var result = falsealarms.map(function(falsealarms){var idb = falsealarms.get('id');var valuea = omission.filter(ee.Filter.eq('id', idb)).first().get('count');var resultvalue = ee.Number(falsealarms.get('count')).subtract(valuea);return omission.set('result', resultvalue)
});

使用它们旨在从两个集合中查找匹配的元素。

函数

ee.Join.saveFirst(matchKey, orderingascendingmeasureKeyouter)

Returns a join that pairs each element from the first collection with a matching element from the second collection. The first match is added to the result as an additional property.

Arguments:

matchKey (String):

The property name used to save the match.

ordering (String, default: null):

The property on which to sort the matches before selecting the first.

ascending (Boolean, default: true):

Whether the ordering is ascending.

measureKey (String, default: null):

An optional property name used to save the measure of the join condition on the match.

outer (Boolean, default: false):

If true, primary rows without matches will be included in the result.

Returns: Join

apply(primary, secondary, condition)

Joins two collections.

Arguments:

this:join (Join):

The join to apply; determines how the the results are constructed.

primary (FeatureCollection):

The primary collection.

secondary (FeatureCollection):

The secondary collection.

condition (Filter):

The join condition used to select the matches from the two collections.

Returns: FeatureCollection

原始代码:

//define the study area 
var roi = roi.filter(ee.Filter.inList('Nomencl', ['SH-21-X-D']));Map.centerObject(roi, 10) Deforestation Mapbiomas///Select the t mapbiomas land use classification
var mabiomas_t = ee.Image('projects/mapbiomas-workspace/public/collection8/mapbiomas_collection80_integration_v1').clip(roi) .select('classification_2000'); // create a list of land use classes from the classification
var fromList = [3, 4, 5, 6, 49, 11, 12, 50, 32, 29, 13, 15, 18, 19, 39, 20, 40, 62, 41, 36, 46, 47, 35, 48, 9, 21, 23, 24, 30, 25, 33, 31, 27];// A corresponding list of replacement values 
var toList =  [1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2];// performs the reclassification
var t_remap = mabiomas_t.remap({from: fromList,to: toList,defaultValue: 0,bandName: 'classification_2000'
}).reproject('EPSG:4326', null, 30);
//Map.addLayer(t_remap)//Select the vegetation land use class
var veg_class_t = t_remap.eq(1) 
//Map.addLayer(veg_class_t, null, 'veg_class_mapbiomas')//Select the t + 1 mapbiomas land use classification
var mapbiomas_t1 = ee.Image('projects/mapbiomas-workspace/public/collection8/mapbiomas_collection80_integration_v1').clip(roi) .select('classification_2020'); var fromList = [3, 4, 5, 6, 49, 11, 12, 50, 32, 29, 13, 15, 18, 19, 39, 20, 40, 62, 41, 36, 46, 47, 35, 48, 9, 21, 23, 24, 30, 25, 33, 31, 27];// A corresponding list of replacement values 
var toList =  [10, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 2
http://www.lryc.cn/news/274991.html

相关文章:

  • mnn-llm: 大语言模型端侧CPU推理优化
  • Freemarker实现Html全站静态化
  • 16.顺子日期(14)
  • 《动手学深度学习》学习笔记 第5章 深度学习计算
  • 【Redis】非关系型数据库之Redis的介绍及安装配置
  • 3D模型轻量化
  • 数据分析——快递电商
  • 《PCI Express体系结构导读》随记 —— 第I篇 第2章 PCI总线的桥与配置(8)
  • Hadoop分布式文件系统(二)
  • macOS跨进程通信: FIFO(有名管道) 创建实例
  • 推荐几个免费的HTTP接口Mock网站和工具
  • 企业数据库安全管理规范
  • react:ffcreator中FFCreatorCenter视频队例
  • 力扣(leetcode)第434题字符串中的单词数(Python)
  • django学习:页面渲染与请求和响应
  • Redis 数据一致性
  • Mac环境下反编译apk
  • 计算机网络——网络模型的组织、看法以及标准化流程
  • 【JAVA】volatile 关键字的作用
  • Next.js 第一次接触
  • CISSP 第7章:PKI和密码学应用
  • dji uav建图导航系列()ROS中创建dji_sdk节点包(二)实现代码
  • 数字化工厂产品推荐 带OPC UA的分布式IO模块
  • 使用OHOS SDK构建opus
  • K-means 聚类算法分析
  • uniapp获取定位
  • Python 面向对象之反射
  • HPM6750开发笔记《DMA接收和发送数据UART例程深度解析》
  • SQL IN 操作符
  • 如何使用Plex在Windows系统搭建个人媒体站点公网可访问