I am a beginner of Google Earth Engine, trying to extract nightlights value by country and year in the African continent for my dissertation.
As a prerequisite for doing so, I am trying to make a list of African countries so that I can extract data, but it does not cover whole countries. In fact, some countries(Gambia, Democratic Republic of Congo, Congo, and Ivory Coast) are not covered as the image indicates. enter image description here In order to fix the issue, I have checked the value in imported data, but name itself seems to be OK. I am not quite sure why I can not extract data by country even if naming is accurate. Please help me fix this issue and offer better and sophisticated solutions. Thx
This is the link of code
This is the link of geological data of African countries. enter link description here
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"])
});