ee.FeatureCollection.getMap

یک تابع ضروری که شناسه و نشانه نقشه را برمی گرداند، مناسب برای ایجاد یک پوشش نقشه.

یک شی را که ممکن است به ee.data.getTileUrl یا ui.Map.addLayer ارسال شود، شامل یک فیلد «تصویر» اضافی، حاوی یک تصویر Collection.draw که یک FeatureCollection حاوی این ویژگی را می‌پیچد، برمی‌گرداند. اگر پاسخ تماس مشخص شده باشد، تعریف نشده است.

استفاده برمی گرداند
FeatureCollection. getMap ( visParams , callback ) MapId|شیء
استدلال تایپ کنید جزئیات
این: featurecollection مجموعه ویژگی ها نمونه FeatureCollection.
visParams شیء، اختیاری پارامترهای تجسم در حال حاضر فقط یک پارامتر، "color" که حاوی یک رشته رنگ RGB است مجاز است. اگر vis_params مشخص نشده باشد، از رنگ #000000 استفاده می شود.
callback عملکرد، اختیاری پاسخ تماس ناهمگام در صورت عدم ارائه، تماس به صورت همزمان انجام می شود.

نمونه ها

ویرایشگر کد (جاوا اسکریپت)

// 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));

راه اندازی پایتون

برای اطلاعات در مورد API پایتون و استفاده از geemap برای توسعه تعاملی به صفحه محیط پایتون مراجعه کنید.

import ee
import geemap.core as geemap

کولب (پایتون)

# 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),
)