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