ee.FeatureCollection.getMap

دالة إلزامية تعرض معرّف خريطة ورمزًا مميّزًا، وهي مناسبة لإنشاء تراكب خريطة.

تعرض هذه الدالة عنصرًا يمكن تمريره إلى ee.data.getTileUrl أو ui.Map.addLayer، بما في ذلك حقل "image" إضافي يحتوي على صورة Collection.draw تغلف FeatureCollection التي تحتوي على هذه الميزة. تكون القيمة غير محدّدة إذا تم تحديد دالة ردّ اتصال.

الاستخدامالمرتجعات
FeatureCollection.getMap(visParams, callback)MapId|Object
الوسيطةالنوعالتفاصيل
هذا: featurecollectionFeatureCollectionمثيل FeatureCollection
visParamsالكائن، اختياريمَعلمات العرض المرئي في الوقت الحالي، يُسمح بمعلَمة واحدة فقط، وهي "اللون"، التي تحتوي على سلسلة ألوان بتنسيق RGB. في حال عدم تحديد vis_params، يتم استخدام اللون ‎#000000.
callbackالدالة، اختياريةمعاودة اتصال غير متزامنة في حال عدم توفيرها، يتم إجراء المكالمة بشكل متزامن.

أمثلة

محرّر الرموز البرمجية (JavaScript)

// FeatureCollection of power plants in Belgium.
var fc = ee.FeatureCollection('WRI/GPPD/power_plants')
            .filter('country_lg == "Belgium"');

// Get MapId for styled FeatureCollection.
var mapId = fc.getMap({color: '800080'});
print('mapId for styled FeatureCollection', mapId);

// MapId can be used as an input to Map.addLayer to display the layer.
Map.setCenter(4.56, 50.78, 7);
Map.addLayer(mapId);

// MapId can be used as an input to ee.data.getTileUrl to fetch map tiles.
print('URL for zoom level 6 tile that includes majority of points',
      ee.data.getTileUrl(mapId, 32, 21, 6));

إعداد Python

راجِع صفحة بيئة Python للحصول على معلومات حول واجهة برمجة التطبيقات Python واستخدام geemap للتطوير التفاعلي.

import ee
import geemap.core as geemap

Colab (Python)

# FeatureCollection of power plants in Belgium.
fc = ee.FeatureCollection('WRI/GPPD/power_plants').filter(
    'country_lg == "Belgium"'
)

# Get MapId for styled FeatureCollection.
map_id = fc.getMapId({'color': '800080'})
display('map_id for FeatureCollection', map_id)

# MapId can be used as an input to geemap.Map.add_layer to display the layer.
m = geemap.Map()
m.set_center(4.56, 50.78, 7)
m.add_layer(map_id['image'])
display(m)

# MapId can be used as an input to ee.data.getTileUrl to fetch map tiles.
display(
    'URL for zoom level 6 tile that includes majority of points',
    ee.data.getTileUrl(map_id, 32, 21, 6),
)