إشعار: يجب
إثبات الأهلية للاستخدام غير التجاري لجميع المشاريع غير التجارية المسجّلة لاستخدام Earth Engine قبل
15 أبريل 2025 من أجل الحفاظ على إمكانية الوصول إليها. إذا لم يتم تأكيد حسابك بحلول 26 سبتمبر 2025، قد يتم تعليق إمكانية الوصول إليه.
ee.Image.remap
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
خرائط من قيم الإدخال إلى قيم الإخراج، ويتم تمثيلها بقائمتَين متوازيتَين. يتم ضبط أي قيم إدخال غير مضمّنة في قائمة الإدخال على defaultValue إذا تم توفيرها أو إخفاؤها إذا لم يتم توفيرها. يُرجى العِلم أنّ المدخلات التي تحتوي على قيم نقطة عائمة قد لا تتطابق أحيانًا بسبب أخطاء دقة النقطة العائمة.
| الاستخدام | المرتجعات |
|---|
Image.remap(from, to, defaultValue, bandName) | صورة |
| الوسيطة | النوع | التفاصيل |
|---|
هذا: image | صورة | الصورة التي يتم تطبيق إعادة الربط عليها. |
from | قائمة | قيم المصدر (أرقام أو ee.Array). سيتم ربط جميع القيم في هذه القائمة بالقيمة المقابلة في "إلى". |
to | قائمة | قيم الوجهة (أرقام أو ee.Array). تُستخدَم هذه القيم لاستبدال القيم المقابلة في "من". يجب أن يحتوي على عدد القيم نفسه الموجود في السمة "from". |
defaultValue | كائن، القيمة التلقائية: null | القيمة التلقائية التي سيتم استبدال القيم التي لم تتطابق مع قيمة في "من" بها في حال عدم تحديدها، يتم إخفاء القيم غير المتطابقة. |
bandName | سلسلة، القيمة التلقائية: null | تمثّل هذه السمة اسم النطاق المطلوب إعادة ربطه. في حال عدم تحديدها، يتم استخدام النطاق الأول في الصورة. |
أمثلة
محرّر الرموز البرمجية (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
راجِع صفحة
بيئة Python للحصول على معلومات حول واجهة برمجة التطبيقات Python واستخدام
geemap للتطوير التفاعلي.
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
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)"],[],["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"]]