お知らせ:
2025 年 4 月 15 日より前に Earth Engine の使用を登録したすべての非商用プロジェクトは、アクセスを維持するために
非商用目的での利用資格を確認する必要があります。2025 年 9 月 26 日までに確認が完了していない場合、アクセスが保留されることがあります。
ee.FeatureCollection.style
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
単純なスタイル言語を使用して、可視化用のベクトル コレクションを描画します。
用途 | 戻り値 |
---|
FeatureCollection.style(color, pointSize, pointShape, width, fillColor, styleProperty, neighborhood, lineType) | 画像 |
引数 | タイプ | 詳細 |
---|
これ: collection | FeatureCollection | 描画するコレクション。 |
color | 文字列、デフォルト: 「black」 | デフォルトの色(CSS 3.0 の色の値。例: 'FF0000' や 'red' など)を指定します。不透明度をサポート(50% 透明な赤の場合は「FF000088」)。 |
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 | 浮動小数点数、デフォルト: 2 | ポリゴンとポイント シェイプの線と枠線のデフォルトの線幅。 |
fillColor | 文字列、デフォルト: null | ポリゴンとポイントの形状を塗りつぶす色。デフォルトは、透明度 0.66 の「color」です。 |
styleProperty | 文字列、デフォルト: null | 辞書を含むことが想定される特徴ごとのプロパティ。ディクショナリの値は、その機能のデフォルト値をオーバーライドします。 |
neighborhood | 整数、デフォルト: 5 | styleProperty が使用され、いずれかのフィーチャーの pointSize または width がデフォルトより大きい場合、タイリング アーティファクトが発生する可能性があります。特徴量に必要な最大近傍(pointSize + width)を指定します。 |
lineType | 文字列、デフォルト: "solid" | 線、ポリゴンの枠線、ポイント シェイプのデフォルトの線スタイル。デフォルトは「solid」です。solid、dotted、dashed のいずれか。 |
例
コードエディタ(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 環境のページをご覧ください。
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
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-26 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-26 UTC。"],[],[]]