公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
ee.ImageCollection.cast
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
将 ImageCollection 中每张图片的部分或全部波段强制转换为指定类型。
用法 | 返回 |
---|
ImageCollection.cast(bandTypes, bandOrder) | ImageCollection |
参数 | 类型 | 详细信息 |
---|
此:collection | ImageCollection | 要投放的图片集。 |
bandTypes | 字典 | 一个从频段名称到频段类型的字典。类型可以是 PixelTypes 或字符串。有效的字符串包括:'int8'、'int16'、'int32'、'int64'、'uint8'、'uint16'、'uint32'、'byte'、'short'、'int'、'long'、'float' 和 'double'。必须包含集合中任何图片中已有的所有波段。如果此参数包含输入图片中尚不存在的波段,则这些波段将作为透明波段添加到图片中。 |
bandOrder | 列表 | 一个列表,用于指定结果中波段的顺序。必须与 bandTypes 的键匹配。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eCasts image bands within an ImageCollection to specified data types like 'int8', 'float', etc., ensuring uniformity across images.\u003c/p\u003e\n"],["\u003cp\u003eRequires a dictionary mapping band names to desired types and a list defining the output band order.\u003c/p\u003e\n"],["\u003cp\u003eThe process adds any new bands specified in the dictionary as transparent bands to images lacking them.\u003c/p\u003e\n"],["\u003cp\u003eInput band types and order must encompass all existing bands within the ImageCollection to avoid errors.\u003c/p\u003e\n"]]],[],null,["# ee.ImageCollection.cast\n\nCasts some or all bands of each image in an ImageCollection to the specified types.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|----------------------------------------------|-----------------|\n| ImageCollection.cast`(bandTypes, bandOrder)` | ImageCollection |\n\n| Argument | Type | Details |\n|--------------------|-----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| this: `collection` | ImageCollection | The image collection to cast. |\n| `bandTypes` | Dictionary | A dictionary from band name to band types. Types can be PixelTypes or strings. The valid strings are: 'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'byte', 'short', 'int', 'long', 'float', and 'double'. Must include all bands already in any image in the collection. If this includes bands that are not already in an input image, they will be added to the image as transparent bands. |\n| `bandOrder` | List | A list specifying the order of the bands in the result. Must match the keys of bandTypes. |"]]