Duyuru:
15 Nisan 2025'ten önce Earth Engine'i kullanmak için kaydedilen tüm ticari olmayan projelerin Earth Engine erişimini sürdürmek için
ticari olmayan uygunluğu doğrulaması gerekir.
ee.Image.remap
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Giriş değerlerinden çıkış değerlerine eşlemeler yapar. Bu eşlemeler, iki paralel liste ile gösterilir. Giriş listesinde yer almayan giriş değerleri, defaultValue verilmişse bu değere ayarlanır, verilmemişse maskelenir. Kayan nokta değerleri içeren girişlerin, kayan nokta duyarlılığı hataları nedeniyle bazen eşleşmeyebileceğini unutmayın.
Kullanım | İadeler |
---|
Image.remap(from, to, defaultValue, bandName) | Resim |
Bağımsız Değişken | Tür | Ayrıntılar |
---|
bu: image | Resim | Yeniden eşlemenin uygulandığı resim. |
from | Liste | Kaynak değerler (sayılar veya ee.Array). Bu listedeki tüm değerler, "to" sütunundaki ilgili değerle eşleştirilir. |
to | Liste | Hedef değerler (sayılar veya ee.Array). Bunlar, "from" parametresindeki ilgili değerleri değiştirmek için kullanılır. "from" ile aynı sayıda değere sahip olmalıdır. |
defaultValue | Nesne, varsayılan: null | "from" içindeki bir değerle eşleşmeyen değerlerin yerine kullanılacak varsayılan değer. Belirtilmezse eşleşmeyen değerler maskelenir. |
bandName | Dize, varsayılan: null | Yeniden eşlenecek bandın adı. Belirtilmezse resimdeki ilk bant kullanılır. |
Örnekler
Kod Düzenleyici (JavaScript)
// A land cover image.
var img = ee.Image('ESA/WorldCover/v100/2020');
// A list of pixel values to replace.
var fromList = [10, 20, 30, 40, 50, 60, 70, 80, 90, 95, 100];
// A corresponding list of replacement values (10 becomes 1, 20 becomes 2, etc).
var toList = [ 1, 2, 2, 2, 3, 2, 4, 5, 6, 6, 2];
// Replace pixel values in the image. If the image is multi-band, only the
// remapped band will be returned. The returned band name is "remapped".
// Input image properties are retained in the output image.
var imgRemap = img.remap({
from: fromList,
to: toList,
defaultValue: 0,
bandName: 'Map'
});
// Display the original and remapped images. Note that similar land cover
// classes in the original image are grouped into aggregate classes by
// from → to value mapping.
Map.addLayer(img, null, 'Original image');
Map.addLayer(imgRemap, {
min: 1, max: 6,
palette:'darkgreen, lightgreen, red, white, blue, lightblue'
}, 'Remapped image');
Python kurulumu
Python API'si ve etkileşimli geliştirme için geemap
kullanımı hakkında bilgi edinmek üzere
Python Ortamı sayfasına bakın.
import ee
import geemap.core as geemap
Colab (Python)
# A land cover image.
img = ee.Image('ESA/WorldCover/v100/2020')
# A list of pixel values to replace.
from_list = [10, 20, 30, 40, 50, 60, 70, 80, 90, 95, 100]
# A corresponding list of replacement values (10 becomes 1, 20 becomes 2, etc).
to_list = [1, 2, 2, 2, 3, 2, 4, 5, 6, 6, 2]
# Replace pixel values in the image. If the image is multi-band, only the
# remapped band will be returned. The returned band name is "remapped".
# Input image properties are retained in the output image.
img_remap = img.remap(from_list, to_list, defaultValue=0, bandName='Map')
# Display the original and remapped images. Note that similar land cover
# classes in the original image are grouped into aggregate classes by
# from → to value mapping.
m = geemap.Map()
m.add_layer(img, None, 'Original image')
m.add_layer(
img_remap,
{
'min': 1,
'max': 6,
'palette': [
'darkgreen',
'lightgreen',
'red',
'white',
'blue',
'lightblue',
],
},
'Remapped image',
)
m
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-26 UTC.
[null,null,["Son güncelleme tarihi: 2025-07-26 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eImage.remap()\u003c/code\u003e function transforms image pixel values by mapping values from an input list (\u003ccode\u003efrom\u003c/code\u003e) to a corresponding output list (\u003ccode\u003eto\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eUnmatched input values are either assigned a specified \u003ccode\u003edefaultValue\u003c/code\u003e or masked if no default is provided.\u003c/p\u003e\n"],["\u003cp\u003eRemapping can be applied to a specific band using the \u003ccode\u003ebandName\u003c/code\u003e parameter, otherwise, the first band is used by default.\u003c/p\u003e\n"],["\u003cp\u003ePotential floating-point precision errors might affect the matching of input values.\u003c/p\u003e\n"]]],["The `Image.remap` function replaces pixel values in an image based on two parallel lists: `from` and `to`. Values in `from` are mapped to corresponding values in `to`. Unmatched values are set to `defaultValue` if provided, otherwise they are masked. The function allows users to specify a `bandName`. It is designed to aggregate similar classes by mapping original values to new values, the remapped band name is \"remapped\".\n"],null,["# ee.Image.remap\n\nMaps from input values to output values, represented by two parallel lists. Any input values not included in the input list are either set to defaultValue if it is given or masked if it isn't. Note that inputs containing floating point values might sometimes fail to match due to floating point precision errors.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|----------------------------------------------------------|---------|\n| Image.remap`(from, to, `*defaultValue* `, `*bandName*`)` | Image |\n\n| Argument | Type | Details |\n|----------------|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| this: `image` | Image | The image to which the remapping is applied. |\n| `from` | List | The source values (numbers or ee.Array). All values in this list will be mapped to the corresponding value in 'to'. |\n| `to` | List | The destination values (numbers or ee.Array). These are used to replace the corresponding values in 'from'. Must have the same number of values as 'from'. |\n| `defaultValue` | Object, default: null | The default value to replace values that weren't matched by a value in 'from'. If not specified, unmatched values are masked out. |\n| `bandName` | String, default: null | The name of the band to remap. If not specified, the first band in the image is used. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// A land cover image.\nvar img = ee.Image('ESA/WorldCover/v100/2020');\n\n// A list of pixel values to replace.\nvar fromList = [10, 20, 30, 40, 50, 60, 70, 80, 90, 95, 100];\n\n// A corresponding list of replacement values (10 becomes 1, 20 becomes 2, etc).\nvar toList = [ 1, 2, 2, 2, 3, 2, 4, 5, 6, 6, 2];\n\n// Replace pixel values in the image. If the image is multi-band, only the\n// remapped band will be returned. The returned band name is \"remapped\".\n// Input image properties are retained in the output image.\nvar imgRemap = img.remap({\n from: fromList,\n to: toList,\n defaultValue: 0,\n bandName: 'Map'\n});\n\n// Display the original and remapped images. Note that similar land cover\n// classes in the original image are grouped into aggregate classes by\n// from → to value mapping.\nMap.addLayer(img, null, 'Original image');\nMap.addLayer(imgRemap, {\n min: 1, max: 6,\n palette:'darkgreen, lightgreen, red, white, blue, lightblue'\n }, 'Remapped image');\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\n# A land cover image.\nimg = ee.Image('ESA/WorldCover/v100/2020')\n\n# A list of pixel values to replace.\nfrom_list = [10, 20, 30, 40, 50, 60, 70, 80, 90, 95, 100]\n\n# A corresponding list of replacement values (10 becomes 1, 20 becomes 2, etc).\nto_list = [1, 2, 2, 2, 3, 2, 4, 5, 6, 6, 2]\n\n# Replace pixel values in the image. If the image is multi-band, only the\n# remapped band will be returned. The returned band name is \"remapped\".\n# Input image properties are retained in the output image.\nimg_remap = img.remap(from_list, to_list, defaultValue=0, bandName='Map')\n\n# Display the original and remapped images. Note that similar land cover\n# classes in the original image are grouped into aggregate classes by\n# from → to value mapping.\nm = geemap.Map()\nm.add_layer(img, None, 'Original image')\nm.add_layer(\n img_remap,\n {\n 'min': 1,\n 'max': 6,\n 'palette': [\n 'darkgreen',\n 'lightgreen',\n 'red',\n 'white',\n 'blue',\n 'lightblue',\n ],\n },\n 'Remapped image',\n)\nm\n```"]]