Ankündigung: Alle nicht kommerziellen Projekte, die vor dem
15. April 2025 für die Nutzung von Earth Engine registriert wurden, müssen
die Berechtigung zur nicht kommerziellen Nutzung bestätigen, um den Zugriff aufrechtzuerhalten. Wenn Sie Ihren Status nicht bis zum 26. September 2025 bestätigen, wird Ihr Zugriff möglicherweise eingeschränkt.
ee.FeatureCollection.style
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Erstelle eine Sammlung von Vektoren zur Visualisierung mit einer einfachen Stilsprache.
| Nutzung | Ausgabe |
|---|
FeatureCollection.style(color, pointSize, pointShape, width, fillColor, styleProperty, neighborhood, lineType) | Bild |
| Argument | Typ | Details |
|---|
So gehts: collection | FeatureCollection | Die zu zeichnende Sammlung. |
color | String, Standard: „black“ | Eine Standardfarbe (CSS 3.0-Farbwert, z.B. 'FF0000' oder 'red') zum Zeichnen der Elemente. Unterstützt die Deckkraft (z.B. „FF000088“ für 50% transparentes Rot). |
pointSize | Ganzzahl, Standard: 3 | Die Standardgröße der Punktmarkierungen in Pixeln. |
pointShape | String, Standard: „circle“ | Die Standardform der Markierung, die an jedem Punkt gezeichnet werden soll. Einer der folgenden Werte: „circle“, „square“, „diamond“, „cross“, „plus“, „pentagram“, „hexagram“, „triangle“, „triangle_up“, „triangle_down“, „triangle_left“, „triangle_right“, „pentagon“, „hexagon“, „star5“, „star6“. Dieses Argument unterstützt auch die folgenden Matlab-Markierungsabkürzungen: „o“, „s“, „d“, „x“, „+“, „p“, „h“, „^“, „v“, „<“, „>“. |
width | Gleitkommazahl, Standardwert: 2 | Die Standardlinienbreite für Linien und Umrisse für Polygone und Punktformen. |
fillColor | String, Standard: null | Die Farbe zum Füllen von Polygonen und Punktformen. Die Standardeinstellung ist „color“ mit einer Deckkraft von 0,66. |
styleProperty | String, Standard: null | Eine Property pro Funktion, die ein Dictionary enthalten soll. Werte im Dictionary überschreiben alle Standardwerte für diese Funktion. |
neighborhood | Ganzzahl, Standard: 5 | Wenn „styleProperty“ verwendet wird und eine Funktion eine „pointSize“ oder „width“ hat, die größer als die Standardwerte ist, können Kachelartefakte auftreten. Gibt die maximale Umgebung (pointSize + width) an, die für ein beliebiges Attribut erforderlich ist. |
lineType | String, Standard: „solid“ | Der Standardlinienstil für Linien und Umrisse von Polygonen und Punktformen. Die Standardeinstellung ist „solid“. Eine der folgenden Optionen: durchgezogen, gepunktet, gestrichelt. |
Beispiele
Code-Editor (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 einrichten
Informationen zur Python API und zur Verwendung von geemap für die interaktive Entwicklung finden Sie auf der Seite
Python-Umgebung.
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
Sofern nicht anders angegeben, sind die Inhalte dieser Seite unter der Creative Commons Attribution 4.0 License und Codebeispiele unter der Apache 2.0 License lizenziert. Weitere Informationen finden Sie in den Websiterichtlinien von Google Developers. Java ist eine eingetragene Marke von Oracle und/oder seinen Partnern.
Zuletzt aktualisiert: 2025-07-26 (UTC).
[null,null,["Zuletzt aktualisiert: 2025-07-26 (UTC)."],[],[]]