Created
January 4, 2020 12:17
-
-
Save henrique/cdbde6182df98f660f7ec94cb652ff1b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Make a suitable image for `reduceConnectedComponents()` | |
// by adding a label band to the `img_pop3` image. | |
img_pop3 = img_pop3.addBands(patchid.select('labels')); | |
// Calculate the total population in demand area | |
// defined by the previously added "labels" band | |
// and reproject to original scale | |
var patchPop = img_pop3.reduceConnectedComponents({ | |
reducer: ee.Reducer.sum(), | |
labelBand: 'labels', | |
}).rename(['pop_total']).reproject(img_pop3.projection()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment