הודעה: כל הפרויקטים הלא מסחריים שנרשמו לשימוש ב-Earth Engine לפני
15 באפריל 2025 חייבים
לאמת את הזכאות לשימוש לא מסחרי כדי לשמור על הגישה. אם לא תאמתו את החשבון עד 26 בספטמבר 2025, יכול להיות שהגישה שלכם תושעה.
ee.FeatureCollection.style
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
ציור של אוסף וקטורים להמחשה באמצעות שפת סגנון פשוטה.
| שימוש | החזרות |
|---|
FeatureCollection.style(color, pointSize, pointShape, width, fillColor, styleProperty, neighborhood, lineType) | תמונה |
| ארגומנט | סוג | פרטים |
|---|
זה: collection | FeatureCollection | האוסף לצביעה. |
color | מחרוזת, ברירת מחדל: 'black' | צבע ברירת מחדל (ערך צבע CSS 3.0, למשל, 'FF0000' או 'red') שבהם ישתמשו לציור התכונות. תמיכה בשקיפות (למשל, 'FF000088' לאדום שקוף ב-50%). |
pointSize | מספר שלם, ברירת מחדל: 3 | גודל ברירת המחדל בפיקסלים של סמני הנקודות. |
pointShape | מחרוזת, ברירת מחדל: circle | צורת ברירת המחדל של הסמן שיוצג בכל נקודת מיקום. אחד מהערכים הבאים: circle, square, diamond, cross, plus, pentagram, hexagram, triangle, triangle_up, triangle_down, triangle_left, triangle_right, pentagon, hexagon, star5, star6. הארגומנט הזה תומך גם בקיצורים הבאים של סמני Matlab: o, s, d, x, +, p, h, ^, v, <,>. |
width | מספר ממשי (float), ברירת מחדל: 2 | רוחב ברירת המחדל של קווים ומתארים של פוליגונים וצורות של נקודות. |
fillColor | מחרוזת, ברירת מחדל: null | הצבע למילוי של פוליגונים וצורות של נקודות. ברירת המחדל היא 'color' באטימות של 0.66. |
styleProperty | מחרוזת, ברירת מחדל: null | מאפיין לכל תכונה שאמור להכיל מילון. הערכים במילון מבטלים את ערכי ברירת המחדל של התכונה. |
neighborhood | מספר שלם, ברירת מחדל: 5 | אם משתמשים ב-styleProperty ולתכונה כלשהי יש pointSize או width גדולים יותר מהערכים שמוגדרים כברירת מחדל, יכולים להופיע ארטיפקטים של יצירת משבצות. מציין את השכונה המקסימלית (pointSize + width) שנדרשת לכל תכונה. |
lineType | מחרוזת, ברירת מחדל: solid | סגנון ברירת המחדל של קווים ומתארים של פוליגונים וצורות של נקודות. ברירת המחדל היא 'solid'. אחת מהאפשרויות: רצוף, מנוקד, מקווקו. |
דוגמאות
עורך הקוד (JavaScript)
// FeatureCollection of power plants in Belgium.
var fc = ee.FeatureCollection('WRI/GPPD/power_plants')
.filter('country_lg == "Belgium"');
// Paint FeatureCollection to an image using collection-wide style arguments.
var fcVis = fc.style({
color: '1e90ff',
width: 2,
fillColor: 'ff475788', // with alpha set for partial transparency
lineType: 'dotted',
pointSize: 10,
pointShape: 'circle'
});
// Display the FeatureCollection visualization (ee.Image) on the map.
Map.setCenter(4.326, 50.919, 9);
Map.addLayer(fcVis, null, 'Collection-wide style');
// Paint FeatureCollection to an image using feature-specific style arguments.
// A dictionary of style properties per power plant fuel type.
var fuelStyles = ee.Dictionary({
Wind: {color: 'blue', pointSize: 5, pointShape: 'circle'},
Gas: {color: 'yellow', pointSize: 6, pointShape: 'square'},
Oil: {color: 'green', pointSize: 3, pointShape: 'diamond'},
Coal: {color: 'red', pointSize: 3, pointShape: 'cross'},
Hydro: {color: 'brown', pointSize: 3, pointShape: 'star5'},
Biomass: {color: 'orange', pointSize: 4, pointShape: 'triangle'},
Nuclear: {color: 'purple', pointSize: 6, pointShape: 'hexagram'},
});
// Add feature-specific style properties to each feature based on fuel type.
fc = fc.map(function(feature) {
return feature.set('style', fuelStyles.get(feature.get('fuel1')));
});
// Style the FeatureCollection according to each feature's "style" property.
var fcVisCustom = fc.style({
styleProperty: 'style',
neighborhood: 8 // maximum "pointSize" + "width" among features
});
// Display the FeatureCollection visualization (ee.Image) on the map.
Map.addLayer(fcVisCustom, null, 'Feature-specific style');
הגדרת 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"'
)
# Paint FeatureCollection to an image using collection-wide style arguments.
fc_vis = fc.style(
color='1e90ff',
width=2,
fillColor='ff475788', # with alpha set for partial transparency
lineType='dotted',
pointSize=10,
pointShape='circle',
)
# Display the FeatureCollection visualization (ee.Image) on the map.
m = geemap.Map()
m.set_center(4.326, 50.919, 9)
m.add_layer(fc_vis, None, 'Collection-wide style')
# Paint FeatureCollection to an image using feature-specific style arguments.
# A dictionary of style properties per power plant fuel type.
fuel_styles = ee.Dictionary({
'Wind': {'color': 'blue', 'pointSize': 5, 'pointShape': 'circle'},
'Gas': {'color': 'yellow', 'pointSize': 6, 'pointShape': 'square'},
'Oil': {'color': 'green', 'pointSize': 3, 'pointShape': 'diamond'},
'Coal': {'color': 'red', 'pointSize': 3, 'pointShape': 'cross'},
'Hydro': {'color': 'brown', 'pointSize': 3, 'pointShape': 'star5'},
'Biomass': {'color': 'orange', 'pointSize': 4, 'pointShape': 'triangle'},
'Nuclear': {'color': 'purple', 'pointSize': 6, 'pointShape': 'hexagram'},
})
# Add feature-specific style properties to each feature based on fuel type.
fc = fc.map(
lambda feature: feature.set('style', fuel_styles.get(feature.get('fuel1')))
)
# Style the FeatureCollection according to each feature's "style" property.
fc_vis_custom = fc.style(
styleProperty='style',
neighborhood=8, # maximum "pointSize" + "width" among features
)
# Display the FeatureCollection visualization (ee.Image) on the map.
m.add_layer(fc_vis_custom, None, 'Feature-specific style')
m
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-26 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-26 (שעון UTC)."],[],[]]