ประกาศ : โปรเจ็กต์ที่ไม่ใช่เชิงพาณิชย์ทั้งหมดที่ลงทะเบียนเพื่อใช้ Earth Engine ก่อนวันที่
15 เมษายน 2025 ต้อง
ยืนยันการมีสิทธิ์ที่ไม่ใช่เชิงพาณิชย์ เพื่อรักษาสิทธิ์เข้าถึง หากคุณไม่ยืนยันภายในวันที่ 26 กันยายน 2025 ระบบอาจระงับสิทธิ์เข้าถึงของคุณ
ส่งความคิดเห็น
Map.addLayer
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เพิ่มออบเจ็กต์ EE ที่ระบุลงในแผนที่เป็นเลเยอร์
แสดงเลเยอร์แผนที่ใหม่
การใช้งาน การคืนสินค้า Map.addLayer(eeObject, visParams , name , shown , opacity )ui.Map.Layer
อาร์กิวเมนต์ ประเภท รายละเอียด eeObjectCollection|Feature|Image|RawMapId ออบเจ็กต์ที่จะเพิ่มลงในแผนที่ visParamsFeatureVisualizationParameters|ImageVisualizationParameters, ไม่บังคับ พารามิเตอร์การแสดงภาพ สำหรับ Images และ ImageCollection โปรดดู ee.data.getMapId เพื่อดูพารามิเตอร์ที่ถูกต้อง สำหรับฟีเจอร์และ FeatureCollection คีย์ที่รองรับมีเพียง "color" ซึ่งเป็นสตริงสี CSS 3.0 หรือสตริงเลขฐานสิบหกในรูปแบบ "RRGGBB" ระบบจะละเว้นเมื่อ eeObject เป็นรหัสแผนที่ nameสตริง ไม่บังคับ ชื่อเลเยอร์ ค่าเริ่มต้นคือ "เลเยอร์ N" shownบูลีน ไม่บังคับ แฟล็กที่ระบุว่าควรเปิดเลเยอร์โดยค่าเริ่มต้นหรือไม่ opacityหมายเลข (ไม่บังคับ) ความทึบแสงของเลเยอร์แสดงเป็นตัวเลขระหว่าง 0 ถึง 1 ค่าเริ่มต้นคือ 1
ตัวอย่าง
โปรแกรมแก้ไขโค้ด (JavaScript)
// A Sentinel-2 surface reflectance image.
var image = ee . Image ( 'COPERNICUS/S2_SR/20210109T185751_20210109T185931_T10SEG' );
Map . setCenter ( - 121.87 , 37.44 , 9 );
// Set multi-band RGB image visualization parameters. If the "bands" parameter
// is not defined, the first three bands are used.
var rgbVis = {
bands : [ 'B11' , 'B8' , 'B3' ],
min : 0 ,
max : 3000
};
Map . addLayer ( image , rgbVis , 'Multi-band RGB image' );
// Set band-specific "min" and "max" properties.
var rgbVisBandSpec = {
bands : [ 'B11' , 'B8' , 'B3' ],
min : [ 0 , 75 , 150 ],
max : [ 3500 , 3000 , 2500 ]
};
Map . addLayer ( image , rgbVisBandSpec , 'Band-specific min/max' );
// If you don't specify "min" and "max" properties, they will be determined
// from the data type range, often resulting in an ineffective color stretch.
Map . addLayer ( image . select ( 'B8' ), null , 'Default visParams' );
// If an image layer has already been styled, set "visParams" as null.
var imageRgb = image . visualize ( rgbVis );
Map . addLayer ( imageRgb , null , 'Pre-styled image' );
// Use the "palette" parameter with single-band image inputs to define the
// linear color gradient to stretch between the "min" and "max" values.
var singleBandVis = {
min : 0 ,
max : 3000 ,
palette : [ 'blue' , 'yellow' , 'green' ]
};
Map . addLayer ( image . select ( 'B8' ), singleBandVis , 'Single-band palette' );
// Images within ImageCollections are automatically mosaicked according to mask
// status and image order. The last image in the collection takes priority,
// invalid pixels are filled by valid pixels in preceding images.
var imageCol = ee . ImageCollection ( 'COPERNICUS/S2_SR' )
. filterDate ( '2021-03-01' , '2021-04-01' );
Map . addLayer ( imageCol , rgbVis , 'ImageCollection mosaic' );
// FeatureCollection, Feature, and Geometry objects can be styled using the
// "color" parameter.
var featureCol = ee . FeatureCollection ( 'WCMC/WDPA/current/polygons' );
Map . addLayer ( featureCol , { color : 'purple' }, 'FeatureCollection' );
ส่งความคิดเห็น
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 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"],[],["The `Map.addLayer` function adds an Earth Engine object to a map as a layer, returning the new `ui.Map.Layer`. It accepts an `eeObject` (Collection, Feature, Image, or RawMapId), optional `visParams` for visualization, `name` for the layer's label, `shown` (boolean) to set default visibility, and `opacity` (0-1). Visualization parameters vary by object type; `color` is the only supported parameter for Features, while Images support `bands`, `min`, `max`, and `palette`. ImageCollections are mosaicked, and the last images take precedence.\n"]]