无法根据导入数据的功能正确创建国家/地区列表



我是谷歌地球引擎的初学者,试图为我的论文提取非洲大陆国家和年份的夜灯价值。

作为这样做的先决条件,我正试图列出一份非洲国家的名单,以便提取数据,但它并不涵盖整个国家。事实上,一些国家(冈比亚、刚果民主共和国、刚果和科特迪瓦(并没有像图片所示的那样被覆盖。在此处输入图像描述为了解决这个问题,我检查了导入数据中的值,但名称本身似乎还可以。我不太确定为什么即使命名准确,我也不能按国家提取数据。请帮助我解决这个问题,并提供更好、更复杂的解决方案。Thx

这是代码的链接

区块报价

这是非洲国家地质数据的链接。在此处输入链接描述

Map.centerObject(table,2);
Map.addLayer(table,{},"Africa");
var countryList = ["Algeria", "Angola", "Benin", "Botswana", "Burkina Faso", "Burundi", "Cameroon", "Cape Verde", "Central African Republic", "Chad", "Comoros", "Republic of the Congo", " Côte d'Ivoire", "Democratic Republic of the Congo", "Djibouti", "Egypt", "Equatorial Guinea", "Eritrea", "Ethiopia", "Gabon", "Gambia", "Ghana", "Guinea", "Guinea-Bissau", "Kenya", "Lesotho", "Liberia", "Libya", "Madagascar", "Malawi", "Mali", "Mauritania", "Mauritius", "Morocco", "Mozambique", "Namibia", "Niger", "Nigeria", "Rwanda", "Sao Tome and Principe", "Senegal", "Seychelles", "Sierra Leone", "Somalia", "South Africa", "South Sudan", "Sudan", "Swaziland", "Togo", "Tunisia", "Uganda", "Tanzania", "Zambia", "Zimbabwe"];
var countries = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017').filter(ee.Filter.inList("country_na", countryList));
Map.addLayer(countries,{},"countries of interest");
Map.centerObject(countries,2);
// import the nightlight image collection

// set the start and end dates
var start = ee.Date.fromYMD(2014,1,1);
var end = ee.Date.fromYMD(2014,12,31);

// filter for the period of interest
var nightlights2014 = nightlight.filterDate(start,end);
// take the mean note that this operation transforms the image collection into an image
nightlights2014 = ee.Image(nightlights2014.mean());
// select the avg_rad band
nightlights2014 = nightlights2014.select("avg_rad");
// clip for the area of interest
nightlights2014 = nightlights2014.clip(countries);
Map.addLayer(nightlights2014,{min:0,max:10,palette:['000000','700000','808080','FFFF00','ffffff','ffffff','ffffff']},"nightlights 2014");
//create a variable for data export
var data_export_2014 = nightlights2014.reduceRegions({
reducer: ee.Reducer.mean(),
collection: countries,
scale: 450
});
//execution of data export
Export.table.toDrive({
collection:data_export_2014,
description: "nightlights2014",
folder: "nightlights_Africa",
selectors: (["mean"])
});

您的名称与countries_na属性的值不一致。例如,在该数据集中,刚果民主共和国缩写为Dem Rep of the Congo。最简单的解决方案可能是将整个国家的数据集加载为地图层,并使用检查器查找正确的名称。或者,您可以使用过滤到非洲的所有国家

var countries = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017')
.filter(ee.Filter.eq("wld_rgn", "Africa"));

相关内容

  • 没有找到相关文章

最新更新