ee.FeatureCollection.getMap

פונקציה אימפרטיבית שמחזירה מזהה ואסימון של מפה, שמתאימים ליצירת שכבת-על של מפה.

הפונקציה מחזירה אובייקט שאפשר להעביר לפונקציה ee.data.getTileUrl או לפונקציה ui.Map.addLayer, כולל שדה נוסף image שמכיל תמונה של Collection.draw שעוטפת FeatureCollection שמכילה את התכונה הזו. אם צוינה קריאה חוזרת (callback), הערך לא מוגדר.

שימושהחזרות
FeatureCollection.getMap(visParams, callback)MapId|Object
ארגומנטסוגפרטים
זה: featurecollectionFeatureCollectionמופע FeatureCollection.
visParamsאובייקט, אופציונליפרמטרים של התצוגה החזותית. בשלב הזה מותר להשתמש רק בפרמטר אחד, color, שמכיל מחרוזת של צבע 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 API ועל שימוש ב-geemap לפיתוח אינטראקטיבי מופיע בדף Python Environment.

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