# How to get the right scale and total value of a world population map using GEE?

I'm trying to understand worldpop data using GEE.

While the scale should be 100 m., using the following code line I get a scale of '111319.49079327357'

``````var pop_scale = pop2015.select(['population']).projection().nominalScale();
``````

print('Scale pop: ', pop_scale);

Moreover, when I try to estimate the world population using a scale of 100 m as it should be, the total world population is about 6.2 billion in 2015, when it should be in fact about 7.3 billion people.

How can I get the right scale using the original data in order to start working with a realistic value of the total world population, that is about 7.3 billion people?

About the "wrong" scale you get when you call `nominalScale()`: The mistake you are making is getting the scale of the mosaiced ImageCollection and not of an unaltered Image in the ImageCollection.

Mosaicing the collection returns a different object which is calculated on the fly by Earth Engine using the default projection WGS84. This object has a different nominal scale of 1 degree which corresponds to the 111319.5 m you get. If you get the scale directly from an Image you get the appropriate 92.76 m which corresponds to 3 arc-seconds. Also see the code below for a comparison.

``````var worldPop = ee.ImageCollection("WorldPop/GP/100m/pop");

var WP_2015  = worldPop
.filter(ee.Filter.equals('year', 2015))
.select('population');

print('No mosaic: ', WP_2015.first().projection().nominalScale())

var pop2015 =  WP_2015.mosaic();
var pop_scale = pop2015.projection().nominalScale();
print('Scale pop: ', pop_scale); // ee.Number
``````

The difference in global population you see might be because the worldpop data on EE is based on census data and the 7 billion figure you expect is likely based on a modelled projection by the UN.

The census data might be quite outdated for some countries, so this could be a reason for the differences you see. For more info you can also see the worldpop website.

• Using the new scale (93 m), I get a total world population equivalent to 7.29 billion. Is there a way to run the original script without using 'mosaic' or does the mosaic function bias the results as the scale is changing? The script does not work without mosaic.
– pmj
May 6, 2021 at 9:41
• You don't need to run the script without `mosaic()`. Since the mosaic is computed on the fly, no values will get computed until they are needed. When values are needed, the default scale of 1 degree is replaced with the required scale and projection (in your case 93 m with WGS84). For more info definitely read through the documentation I linked in my answer. May 6, 2021 at 10:10

I don't know what is your source but, I calculated total population preserving scale and result was 6308,113,647.54873. Following script calculates total population by country and it corroborates if scale was preserved. Sum was calculated in GEE console editor and it was also corroborated in a spreadsheet by using obtained CSV.

``````var worldPop = ee.ImageCollection("WorldPop/GP/100m/pop");

var WP_2015  = worldPop
.filter(ee.Filter.equals('year', 2015))
.select('population');

print("WP_2015", WP_2015);

var country = WP_2015.aggregate_array('country');

print(country);

var listOfImages = WP_2015.toList(WP_2015.size());

var popcountry = listOfImages.map(function (img) {

var idx = ee.List(listOfImages).indexOf(ee.Image(img));

var geom = ee.Image(img).geometry();

var pop = ee.Image(img).reduceRegions({
collection: geom,
reducer: ee.Reducer.sum(),
scale: 100,
crs: 'EPSG:4326', // world wide crs
});

pop = pop.aggregate_array('sum').get(0);

return [ee.Image(img).projection().nominalScale(), pop, country.get(idx)];

});

var sumPop2015 = popcountry.map(function(ele) {

return ee.List(ele).get(1);

}).reduce(ee.Reducer.sum());

print("sumPop2015", sumPop2015);

//print(popcountry;

var pop_country_list = ee.FeatureCollection(popcountry
.map(function(element){
return ee.Feature(null,{
'scale':ee.List(element).get(0),
'population':ee.List(element).get(1),
'country':ee.List(element).get(2)
}
)}));

//Export.table.toAsset(popcountry, 'worldPopTest', 'worldPopTest')
Export.table.toDrive({
collection:pop_country_list,
folder: "GEE_Folder",
description:'Population_World_2015',
fileFormat: 'csv'
});
``````

After running above script, I got in my Google Drive following CSV file. It can be observed that scale was preserved in each calculation and it is the same for all cases (92.7662420315015 meters).

``````system:index,country,population,scale,.geo
0,ABW,93730.83276202157,92.76624203150153,
1,AFG,2.340477555199975E7,92.76624195554629,
2,AGO,2.20921628071265E7,92.76624195665957,
3,AIA,12300.492908239365,92.7662419655107,
4,ALA,25131.47910252493,92.76624196389417,
5,ALB,2384892.1986952466,92.76624196974053,
6,AND,83812.57329584938,92.76624192545314,
7,ARE,6120078.421326031,92.76624195296404,
8,ARG,3.6633866554902196E7,92.76624195582603,
9,ARM,2431257.7082180567,92.76624195670749,
10,ASM,47974.10031256126,92.76624195349083,
11,ATA,0.0,92.76624195651415,
12,ATF,0.0,92.76624195651414,
13,ATG,77376.63159601949,92.76624195881988,
14,AUS,1.8471444804686733E7,92.76624195673739,
15,AUT,7374904.951186942,92.7662419502098,
16,AZE,8264892.955935077,92.76624195456793,
17,BDI,8412844.197635062,92.76624197334607,
18,BEL,9661785.90443113,92.76624196234187,
19,BEN,9284823.293204356,92.76624196433576,
20,BES,22123.676203567535,92.76624195194722,
21,BFA,1.6360711388349723E7,92.76624195732843,
22,BGD,1.3181383967733985E8,92.76624196168282,
23,BGR,6169452.89038309,92.76624195317095,
24,BHR,1452692.670988679,92.76624196883141,
25,BHS,327000.8951052807,92.76624195782351,
26,BIH,2992520.2291056667,92.76624195420445,
27,BLM,8907.086962204427,92.76624213645677,
28,BLR,7985572.253991915,92.76624195474425,
29,BLZ,316380.4257440753,92.76624194207054,
30,BMU,56339.41807849705,92.76624200297772,
31,BOL,9186268.737265516,92.76624195651492,
32,BRA,1.7493486940023416E8,92.7662419573614,
33,BRB,243722.81501033902,92.76624191558562,
34,BRN,361914.95434038993,92.76624197576525,
35,BTN,655816.6576714728,92.76624195889725,
36,BVT,0.0,92.76624195651283,
37,BWA,1880744.5872802397,92.76624195807211,
38,CAF,4200019.459050268,92.76624195980142,
39,CAN,3.019312822626531E7,92.76624195641577,
40,CHE,7162488.379260418,92.76624196143786,
41,CHL,1.6134475463626033E7,92.76624195676911,
42,CHN,1.1919655788229954E9,92.7662419568716,
43,CIV,2.0023849860933296E7,92.76624195621609,
44,CMR,2.0579580008314766E7,92.76624195610817,
45,COD,7.671517394093508E7,92.7662419560702,
46,COG,3075684.1103864927,92.76624195534805,
47,COK,15323.444163044915,92.7662419549728,
48,COL,4.734570209508599E7,92.76624195787426,
49,COM,675155.5833898336,92.76624194945494,
50,CPV,443691.53169266693,92.76624196409792,
51,CRI,3889029.629431915,92.7662419546676,
52,CUB,9616092.36178252,92.76624195535337,
53,CUW,138589.91146118753,92.76624203152205,
54,CYM,55786.508367991075,92.76624193648503,
55,CYP,1053334.6544193083,92.76624194112415,
56,CZE,9101144.708243014,92.76624194992117,
57,DEU,6.835561844397488E7,92.76624195922638,
58,DJI,851857.4784023892,92.76624195880855,
59,DMA,61234.30789568275,92.76624189288154,
60,DNK,4911981.952471856,92.76624196611694,
61,DOM,9132140.861431893,92.76624194838084,
62,DZA,3.370016484194292E7,92.7662419547008,
63,ECU,1.3768912794992708E7,92.7662419577934,
64,EGY,7.43770843484119E7,92.76624195586892,
65,ERI,3349884.026588017,92.76624195698835,
66,ESH,385425.1244367943,92.76624195516621,
67,ESP,4.260812185023105E7,92.76624195480893,
68,EST,1135289.6440928853,92.76624195307026,
69,ETH,7.83601962641859E7,92.76624195669787,
70,FIN,4713726.16926714,92.76624195926796,
71,FJI,745790.2485074569,92.76624195482535,
72,FLK,2355.0932764417794,92.7662419626707,
73,FRA,5.6205244398110844E7,92.76624195462139,
74,FRO,43673.85855452277,92.76624196408768,
75,FSM,88381.52657399548,92.76624195421824,
76,GAB,2115874.6682753107,92.76624195269208,
77,GBR,5.60120103069756E7,92.76624195943809,
78,GEO,3365801.87235719,92.76624195282413,
79,GGY,55444.28661817685,92.76624198349305,
80,GHA,2.447859359228225E7,92.76624195497752,
81,GIB,29349.25133395195,92.76624169880266,
82,GIN,9288645.855314255,92.76624195862829,
83,GLP,357187.1589214206,92.76624195626042,
84,GMB,1737770.9679132625,92.76624196271067,
85,GNB,1432528.5355311278,92.76624194554317,
86,GNQ,1052395.6010867604,92.76624195943532,
87,GRC,9268051.923107764,92.76624195715758,
88,GRD,89099.7645566538,92.76624192328156,
89,GRL,49137.32960959966,92.76624195651536,
90,GTM,1.3922520288689472E7,92.76624196401464,
91,GUF,245666.59586109273,92.76624196518878,
92,GUM,139857.85780520452,92.76624195284366,
93,GUY,635225.5814076891,92.76624195678951,
94,HKG,6238534.696937755,92.76624193491268,
95,HMD,0.0,92.76624195651316,
96,HND,7443103.35338946,92.76624195592595,
97,HRV,3641182.094604567,92.7662419599591,
98,HTI,1.0447571379868435E7,92.76624194986455,
99,HUN,8316743.487714838,92.76624195364461,
100,IDN,2.2281184126531056E8,92.76624195687849,
101,IMN,75888.74137841468,92.7662419757111,
102,IND,1.1139607615388715E9,92.76624195704358,
103,IOT,0.0,92.76624195651571,
104,IRL,4249618.268995342,92.76624195792984,
105,IRN,6.629052251703271E7,92.76624195751732,
106,IRQ,3.2731192238574125E7,92.76624195992798,
107,ISL,293251.98801409756,92.76624195161989,
108,ISR,6948955.773099429,92.76624194842636,
109,ITA,5.21430265691184E7,92.76624195386687,
110,JAM,2354503.59552316,92.76624193938378,
111,JEY,88635.8443978997,92.76624192996165,
112,JOR,5536536.638024364,92.76624196138506,
113,JPN,1.1052413576762736E8,92.76624195508388,
114,KAZ,1.4639509971455902E7,92.76624195510995,
115,KEN,4.019533967772566E7,92.76624195796167,
116,KGZ,4760512.752516646,92.76624195832323,
117,KHM,1.3806241910693897E7,92.76624195334132,
118,KIR,93373.78330201725,92.76624195735305,
119,KNA,48862.731952250004,92.7662419481209,
120,KOR,4.2792447635866985E7,92.76624195205969,
121,KOS,1659440.4958254918,92.76624196063572,
122,KWT,2637238.9725506622,92.76624195828799,
123,LAO,5865821.361215223,92.76624195982797,
124,LBN,6576508.852356182,92.7662419381783,
125,LBR,3502728.230832478,92.76624195614266,
126,LBY,5560007.139590014,92.7662419575869,
127,LCA,146719.536134094,92.76624180534343,
128,LIE,32547.09543043375,92.76624200142814,
129,LKA,1.7923877012835678E7,92.76624195499933,
130,LSO,1618473.7045259401,92.76624195827598,
131,LTU,2502286.0540419137,92.76624194805132,
132,LUX,470754.5834663138,92.76624191952068,
133,LVA,1933955.758060588,92.76624195966214,
134,MAC,523898.5437287092,92.76624232773361,
135,MAF,36459.547257788305,92.766242053257,
136,MAR,2.8903557060184665E7,92.76624195364501,
137,MCO,33134.9302148819,92.76624128060273,
138,MDA,3235816.926124163,92.76624196072582,
139,MDG,2.023836366427694E7,92.76624195357452,
140,MDV,351431.61338223284,92.76624197637605,
141,MEX,1.0648769835177247E8,92.76624195669856,
142,MHL,46977.83904653392,92.7662419571226,
143,MKD,1787331.5773339956,92.76624194779298,
144,MLI,1.5981149305262683E7,92.76624195764754,
145,MLT,367900.7626681626,92.76624193696745,
146,MMR,4.296158459521743E7,92.76624195689895,
147,MNE,530694.6122701971,92.7662419382195,
148,MNG,2469044.748699612,92.76624195482852,
149,MNP,41001.72254395409,92.76624196225616,
150,MOZ,2.245398752169323E7,92.7662419566124,
151,MRT,3246677.351122342,92.76624195768997,
152,MSR,4396.233189463615,92.76624201850846,
153,MTQ,351471.9029857367,92.76624202353996,
154,MUS,1084339.152125074,92.76624195785007,
155,MWI,1.3684047138662053E7,92.7662419498418,
156,MYS,2.6564279423235435E7,92.76624195389408,
157,MYT,199477.67985621095,92.76624195554416,
158,NAM,1936092.9844357949,92.76624195957109,
159,NCL,233174.2419489387,92.76624195506713,
160,NER,1.6693874439664934E7,92.76624195685314,
161,NFK,1827.2254648767412,92.76624199640895,
162,NGA,1.5953622737024903E8,92.76624195467537,
163,NIC,5338434.694455473,92.76624196037862,
164,NIU,1225.1448503341526,92.76624208957833,
165,NLD,1.4593088283105092E7,92.76624196457801,
166,NOR,4397431.420111985,92.76624195611464,
167,NPL,2.6436141758755725E7,92.76624195497497,
168,NRU,8460.555747449398,92.76624173369474,
169,NZL,3704001.85203441,92.76624195582156,
170,OMN,2722898.7647684184,92.76624196095571,
171,PAK,1.7623282654873228E8,92.76624195457899,
172,PAN,3211973.4440140375,92.76624196133004,
173,PCN,66.73547416366637,92.76624197042925,
174,PER,2.7590255108301166E7,92.76624195701484,
175,PHL,8.627788366811709E7,92.76624195603276,
176,PLW,20665.83026848361,92.7662419652247,
177,PNG,6839554.411169346,92.76624195633485,
178,POL,3.3375382205850285E7,92.76624196133578,
179,PRI,3174258.991762086,92.76624197656258,
180,PRK,2.0196322113909494E7,92.76624195885229,
181,PRT,9146853.60412426,92.76624195540369,
182,PRY,5888002.365795881,92.76624195562482,
183,PSE,4336188.665138241,92.76624195785034,
184,PYF,248805.68880761834,92.76624195774924,
185,QAT,2906194.271652919,92.76624196261749,
186,REU,768459.7720868997,92.76624197986328,
187,ROU,1.8056949197345853E7,92.76624195037432,
188,RUS,1.21917946285997E8,92.7662419566744,
189,RWA,9893981.957982957,92.76624196367031,
190,SAU,2.732147668392207E7,92.76624195783388,
191,SDN,3.2026521173294615E7,92.76624195648866,
192,SEN,1.2310424764027297E7,92.76624195341357,
193,SGP,3521784.476957731,92.7662419281369,
194,SGS,0.0,92.76624195651428,
195,SHN,3711.302061419934,92.76624195609185,
196,SJM,2424.0356935820455,92.76624195705465,
197,SLB,512887.0947415766,92.76624195501697,
198,SLE,5338836.763008777,92.76624195391516,
199,SLV,5413187.310441062,92.76624195356112,
200,SMR,28314.314397703856,92.76624203797302,
201,SOM,8362838.283559386,92.76624195514385,
202,SPM,5126.570784281474,92.76624196718625,
203,SPR,0.0,92.76624195651368,
204,SRB,6085677.735834256,92.76624195521109,
205,SSD,1.0161754283455003E7,92.76624195464596,
206,STP,164660.94702617824,92.76624194727354,
207,SUR,488640.15111443424,92.76624195856793,
208,SVK,4658629.92797723,92.76624194896623,
209,SVN,1823089.089664325,92.76624196763461,
210,SWE,8444327.654433187,92.7662419556237,
211,SWZ,916159.3794749863,92.7662419693677,
212,SXM,25512.04384386912,92.7662416236301,
213,SYC,83708.80992183229,92.76624195492482,
214,SYR,2.0353764768443912E7,92.76624195395421,
215,TCA,30674.78065824206,92.76624194346311,
216,TCD,1.1839628106698224E7,92.76624195971735,
217,TGO,6290154.775860593,92.76624196916745,
218,THA,6.017167791833479E7,92.7662419548934,
219,TJK,7251558.26505609,92.76624196175763,
220,TKL,1182.2910749316216,92.76624198537516,
221,TKM,7403964.132987917,92.76624195450788,
222,TLS,1052805.9721332118,92.76624196075143,
223,TON,90135.20377973095,92.766241956124,
224,TTO,1166039.7972417772,92.76624197971252,
225,TUN,9561812.102737695,92.76624195948855,
226,TUR,6.5982212542030506E7,92.76624195463533,
227,TUV,10161.26424543187,92.76624194807445,
228,TWN,2.0317326809117302E7,92.76624195402276,
229,TZA,4.204579101413039E7,92.76624195604045,
230,UGA,3.09408542000589E7,92.76624195319336,
231,UKR,3.864052728588031E7,92.76624195728432,
232,UMI,0.0,92.76624195666301,
233,URY,2858971.8094643857,92.7662419532036,
234,USA,2.797783432320805E8,92.766241956663,
235,UZB,2.668252475091501E7,92.76624195581377,
236,VAT,762.8069806098938,92.76624597209201,
237,VCT,94901.03555836529,92.76624200238741,
238,VEN,2.515381289980159E7,92.76624195806465,
239,VGB,26667.944341290276,92.76624193293297,
240,VIR,90977.89779884368,92.76624199091319,
241,VNM,7.96463082113864E7,92.76624195532072,
242,VUT,231327.33333297257,92.76624195099427,
243,WLF,9956.675465136766,92.7662419372125,
244,WSM,166284.3753012754,92.76624196045594,
245,YEM,2.2753900994522955E7,92.7662419567921,
246,ZAF,4.7529834568473876E7,92.76624195579765,
247,ZMB,1.3358042870822748E7,92.76624196058133,
248,ZWE,1.1645234698363546E7,92.76624195366828,
``````
• Knowing now that the scale is 92.7 m (and not 100 m), I then ran again the two scripts of above replacing the 'scale' with 93 as a proxy (it did not work with 92.7) instead of 100 m. The new estimates of the total world population is about 7.29 billions which is certainly a more realistic value to work with. Is there a way to use the original scale of '92.76624191952068'?
– pmj
May 6, 2021 at 9:41