working with worldpop

population dynamics

Question 1:

copy the code below into the earth engine code editor and hit run

// import worldpop data
var wp = ee.Image("WorldPop/GP/100m/pop/KHM_2020");
 
// add to map
Map.addLayer(wp,{min:0,max:100,palette:['white','gray','black']},"population");

Try to answer the following questions

  1. What is the date of the image?
  2. what is the spatial resolution?
  3. What is the unit of the data?

Question 2:

copy the code below into the earth engine code editor and hit run

// import worldpop data
var wp2000 = ee.Image("WorldPop/GP/100m/pop/KHM_2000");
// add to map
Map.addLayer(wp2000,{min:0,max:100,palette:['white','gray','black']},"population");

// import worldpop data
var wp2020 = ee.Image("WorldPop/GP/100m/pop/KHM_2020");
 // add to map
Map.addLayer(wp2020,{min:0,max:100,palette:['white','gray','black']},"population");

Try to answer the following questions

  1. where do we see the main differences in the imagery?
  2. do you see any image artifacts?

Question 3:

Draw an area around Phnom Penh

copy the code below into the previous code and hit run

print(wp2000.reduceRegion({reducer:ee.Reducer.sum(),geometry:aoi,scale:100}));
print(wp2020.reduceRegion({reducer:ee.Reducer.sum(),geometry:aoi,scale:100}));

Try to answer the following questions

  1. why do we use the sum in this example?
  2. what is the estimated population in Siem Reap?

Question 4

Use the code below to calculate the population for each province

// define the countries of interest 
var cambodia = ee.FeatureCollection("projects/servir-mekong/admin/KHM_adm1")


// import worldpop data
var wp = ee.ImageCollection("WorldPop/GP/100m/pop").filterBounds(cambodia);


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

// filter for the period of interest
var wp2020 = ee.Image(wp.filterDate(start,end).mean());

// clip for the area of interest
wp2020 = wp2020.clip(cambodia);

Map.addLayer(wp2020,{min:0,max:100,palette:['white','gray','black']},"population 2020");


var totalPopulation = wp2020.reduceRegion({reducer:ee.Reducer.sum(),scale:100,geometry:cambodia,maxPixels:1e13})
print("Total Population:",totalPopulation)

var chart =
    ui.Chart.image.byRegion
        ({
          image:wp2020,
          regions: cambodia,
          reducer: ee.Reducer.sum(),
          scale: 100,
          xProperty: 'NAME_1'
        })
        .setSeriesNames(['population'])
        .setChartType('ColumnChart')
        .setOptions({
          title: 'population per provinces',
          hAxis: {title: 'Date', titleTextStyle: {italic: false, bold: true}},
          vAxis: {
            title: 'total population',
            titleTextStyle: {italic: false, bold: true}
          },
          lineWidth: 5,
          colors: ['e37d05'],
          curveType: 'function'
        });
         
print(chart);

Leave a Reply