我正在尝试在 Google 地球引擎 (GEE) 代码编辑器中获取图像集中的图像数量。图像集filteredCollection
包含 GEE 上覆盖格林威治的所有 Landsat 8 图像(仅作为示例)。
图像数量打印为 113,但它似乎不是整数类型,我也无法将其强制为整数。看起来是这样的:
var imageCollection = ee.ImageCollection("LANDSAT/LC8_SR");
var point = ee.Geometry.Point([0.0, 51.48]);
var filteredCollection = imageCollection.filterBounds(point);
var number_of_images = filteredCollection.size();
print(number_of_images); // prints 113
print(number_of_images > 1); // prints false
print(+number_of_images); // prints NaN
print(parseInt(number_of_images, 10)); // prints NaN
print(Number(number_of_images)); // prints NaN
print(typeof number_of_images); // prints object
print(number_of_images.constructor); // prints <Function>
print(number_of_images.constructor.name); // prints Ik
var number_of_images_2 = filteredCollection.length;
print(number_of_images_2); // prints undefined
知道这里发生了什么以及如何将集合中的图像数量作为整数获取吗?
PS:Collection.size() 是获取GEE 文档中图像数量的推荐函数。