Thursday, 27 October 2016

Calculating number of pixels in polygon using Google Earthy Engine?


How to calculate the number of pixels in a polygon, especially, when an image contains null-value pixels? I tried the function ee.Reducer.countEvery(), but it does not work.


var geometry = /* color: #d63000 */ee.Geometry.Polygon(
[[[-122.420654296875, 37.96148894979038],
[-122.530517578125, 37.735934739135104],
[-122.244873046875, 37.82276800453933],

[-121.904296875, 37.87481898883636]]]);

// Load a Landsat 8 image.
var image = ee.Image('LANDSAT/LC08/C01/T1/LC08_044034_20140318');


var c=image.reduceRegion({
reducer: ee.Reducer.countEvery(),
geometry: geometry
});


print(c);


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...