Earth Engine ขอแนะนำ
ระดับโควต้าที่ไม่ใช่เชิงพาณิชย์เพื่อปกป้องทรัพยากรการประมวลผลที่ใช้ร่วมกันและรับประกันประสิทธิภาพที่เชื่อถือได้สำหรับทุกคน โปรเจ็กต์ที่ไม่ใช่เชิงพาณิชย์ทั้งหมดจะต้องเลือกระดับโควต้าภายในวันที่
27 เมษายน 2026 หรือจะใช้ระดับชุมชนโดยค่าเริ่มต้นก็ได้ โควต้าระดับจะมีผลกับโปรเจ็กต์ทั้งหมด (ไม่ว่าวันที่เลือกระดับจะเป็นวันใด) ในวันที่
27 เมษายน 2026 ดูข้อมูลเพิ่มเติม
Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
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 | String, ค่าเริ่มต้น: "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 | สีสำหรับเติมรูปหลายเหลี่ยมและรูปร่างจุด ค่าเริ่มต้นคือ "สี" ที่ความทึบแสง 0.66 |
styleProperty | สตริง ค่าเริ่มต้น: null | พร็อพเพอร์ตี้ต่อฟีเจอร์ที่คาดว่าจะมีพจนานุกรม ค่าในพจนานุกรมจะลบล้างค่าเริ่มต้นของฟีเจอร์นั้น |
neighborhood | จำนวนเต็ม ค่าเริ่มต้น: 5 | หากใช้ styleProperty และฟีเจอร์ใดมี pointSize หรือความกว้างมากกว่าค่าเริ่มต้น อาจเกิดอาร์ติแฟกต์การแบ่งไทล์ ระบุขอบเขตสูงสุด (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
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"],[],[]]