公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
ee.Image.regexpRename
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
通过对当前波段名称应用正则表达式替换来重命名映像的波段。未与正则表达式匹配的任何频段都将复制过来,而不会重命名。
用法 | 返回 |
---|
Image.regexpRename(regex, replacement, all) | 图片 |
参数 | 类型 | 详细信息 |
---|
此:input | 图片 | 包含要重命名的波段的图片。 |
regex | 字符串 | 用于在每个频段名称中进行匹配的正则表达式。 |
replacement | 字符串 | 用于替换每个匹配项的文本。支持用于捕获值的 $n 语法。 |
all | 布尔值,默认值:true | 如果为 true,则替换给定字符串中的所有匹配项。否则,系统只会替换每个字符串中的第一个匹配项。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eApplies a regular expression to rename image bands, leaving unmatched bands unchanged.\u003c/p\u003e\n"],["\u003cp\u003eOffers flexibility to replace all regex matches or only the first match in each band name using the \u003ccode\u003eall\u003c/code\u003e parameter.\u003c/p\u003e\n"],["\u003cp\u003eUses \u003ccode\u003e$n\u003c/code\u003e syntax in the 'replacement' argument to utilize captured values from the regex.\u003c/p\u003e\n"],["\u003cp\u003eOperates directly on the provided input image and returns a modified image with the renamed bands.\u003c/p\u003e\n"]]],["This functionality renames image bands using regular expressions. It takes an image, a `regex` to match band names, and a `replacement` string (supporting captured groups via `$n`). Bands not matching the `regex` remain unchanged. An optional `all` parameter (defaulting to `true`) determines whether to replace all regex matches or just the first one per band name. The function returns a new image with the updated band names.\n"],null,["# ee.Image.regexpRename\n\nRenames the bands of an image by applying a regular expression replacement to the current band names. Any bands not matched by the regex will be copied over without renaming.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|---------------------------------------------------|---------|\n| Image.regexpRename`(regex, replacement, `*all*`)` | Image |\n\n| Argument | Type | Details |\n|---------------|------------------------|---------------------------------------------------------------------------------------------------------------------------|\n| this: `input` | Image | The image containing the bands to rename. |\n| `regex` | String | A regular expression to match in each band name. |\n| `replacement` | String | The text with which to replace each match. Supports $n syntax for captured values. |\n| `all` | Boolean, default: true | If true, all matches in a given string will be replaced. Otherwise, only the first match in each string will be replaced. |"]]