การแสดงภาพคอลเล็กชัน

รูปภาพที่ประกอบเป็น ImageCollection สามารถแสดงเป็นภาพเคลื่อนไหวหรือชุดภาพขนาดย่อที่เรียกว่า "แถบแสดงตัวอย่างรูปภาพ" วิธีการเหล่านี้ช่วยให้ประเมินเนื้อหาของ ImageCollection ได้อย่างรวดเร็วและเป็นสื่อที่มีประสิทธิภาพในการดูการเปลี่ยนแปลงเชิงพื้นที่และเวลา (รูปที่ 1)

ส่วนต่อไปนี้จะอธิบายวิธีเตรียม ImageCollection สำหรับการแสดงภาพ ให้โค้ดตัวอย่างสำหรับวิธีการแสดงภาพคอลเล็กชันแต่ละวิธี และครอบคลุมเทคนิคแอนิเมชันขั้นสูงหลายอย่าง


รูปที่ 1 ภาพเคลื่อนไหวแสดงความคืบหน้า 3 วันของพายุเฮอริเคนแอตแลนติกในเดือนกันยายน 2017

การเตรียมการเก็บรวบรวมข้อมูล

กรอง ผสม จัดเรียง และจัดรูปแบบรูปภาพภายในคอลเล็กชันเพื่อแสดงเฉพาะรูปภาพที่น่าสนใจหรือเน้นปรากฏการณ์ คุณสามารถใช้ ImageCollection ใดก็ได้เป็นอินพุตสำหรับฟังก์ชันการแสดงภาพ แต่คอลเล็กชันที่คัดสรรมาโดยพิจารณาช่วงวันที่ระหว่างปีและภายในปี ช่วงเวลาการสังเกตการณ์ ขอบเขตระดับภูมิภาค คุณภาพ และการนำเสนอจะให้ผลลัพธ์ที่ดีกว่า

ตัวกรอง

กรองคอลเล็กชันรูปภาพให้มีเฉพาะข้อมูลที่เกี่ยวข้องซึ่งสนับสนุนวัตถุประสงค์ของการแสดงภาพ พิจารณาวันที่ ขอบเขตเชิงพื้นที่ คุณภาพ และพร็อพเพอร์ตี้อื่นๆ ที่เฉพาะเจาะจงสำหรับชุดข้อมูลหนึ่งๆ

ตัวอย่างเช่น กรองคอลเล็กชันการสะท้อนพื้นผิว Sentinel-2 ตามเกณฑ์ต่อไปนี้

ช่วงวันที่เดียว

ตัวแก้ไขโค้ด (JavaScript)

var s2col = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED')
  .filterDate('2018-01-01', '2019-01-01');

ช่วงวันของปีแบบต่อเนื่อง

ตัวแก้ไขโค้ด (JavaScript)

var s2col = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED')
  .filter(ee.Filter.calendarRange(171, 242, 'day_of_year'));

ภูมิภาคที่สนใจ

ตัวแก้ไขโค้ด (JavaScript)

var s2col = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED')
  .filterBounds(ee.Geometry.Point(-122.1, 37.2));

หรือพร็อพเพอร์ตี้รูปภาพ

ตัวแก้ไขโค้ด (JavaScript)

var s2col = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED')
  .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 50));

เชื่อมโยงตัวกรองหลายรายการ

ตัวแก้ไขโค้ด (JavaScript)

var s2col = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED')
  .filterDate('2018-01-01', '2019-01-01')
  .filterBounds(ee.Geometry.Point(-122.1, 37.2))
  .filter('CLOUDY_PIXEL_PERCENTAGE < 50');

วัสดุผสม

รวมช่วงวันที่ภายในปีและระหว่างปีเพื่อลดจำนวนรูปภาพในคอลเล็กชันและปรับปรุงคุณภาพ ตัวอย่างเช่น สมมติว่าคุณต้องการสร้าง การแสดงภาพ NDVI ประจำปีสำหรับแอฟริกา ตัวเลือกหนึ่งคือการกรองคอลเล็กชัน NDVI 16 วันของ MODIS เพื่อรวมการสังเกตการณ์ทั้งหมดในปี 2018

ตัวแก้ไขโค้ด (JavaScript)

var ndviCol = ee.ImageCollection('MODIS/061/MOD13A2')
  .filterDate('2018-01-01', '2019-01-01')
  .select('NDVI');

ภาพรวมระหว่างปีตามตัวกรองและการลด

การแสดงภาพของคอลเล็กชันด้านบนแสดงให้เห็นนอยส์จำนวนมากในบริเวณป่าที่มีเมฆปกคลุมหนาแน่น (รูปที่ 2ก) การแสดงผลที่ดีขึ้นสามารถทำได้โดยการลดช่วงวันที่แบบอนุกรมตามค่ามัธยฐานในทุกปีในคอลเล็กชัน MODIS

ตัวแก้ไขโค้ด (JavaScript)

// Make a day-of-year sequence from 1 to 365 with a 16-day step.
var doyList = ee.List.sequence(1, 365, 16);

// Import a MODIS NDVI collection.
var ndviCol = ee.ImageCollection('MODIS/061/MOD13A2').select('NDVI');

// Map over the list of days to build a list of image composites.
var ndviCompList = doyList.map(function(startDoy) {
  // Ensure that startDoy is a number.
  startDoy = ee.Number(startDoy);

  // Filter images by date range; starting with the current startDate and
  // ending 15 days later. Reduce the resulting image collection by median.
  return ndviCol
    .filter(ee.Filter.calendarRange(startDoy, startDoy.add(15), 'day_of_year'))
    .reduce(ee.Reducer.median());
});

// Convert the image List to an ImageCollection.
var ndviCompCol = ee.ImageCollection.fromImages(ndviCompList);

ภาพเคลื่อนไหวที่ได้จากคอลเล็กชันนี้มีสัญญาณรบกวนน้อยกว่า เนื่องจากรูปภาพแต่ละรูปแสดงค่ามัธยฐานของ NDVI แบบผสม 16 วันสำหรับข้อมูลมากกว่า 20 ปี (รูปที่ 1ข) ดูข้อมูลเพิ่มเติมเกี่ยวกับภาพเคลื่อนไหวนี้ได้ในบทแนะนำนี้

รูปที่ 2ก NDVI รายปีที่ไม่มีการรวมภาพระหว่างปี รูปที่ 2ข NDVI รายปีพร้อมการจัดองค์ประกอบระหว่างปี

ภาพรวมภายในปีโดยใช้ตัวกรองและลดขนาด

ตัวอย่างก่อนหน้านี้ใช้การจัดองค์ประกอบภาพแบบข้ามปี นอกจากนี้ การรวมชุดการสังเกตการณ์ภายในปีเดียวกันก็มีประโยชน์เช่นกัน ตัวอย่างเช่น ข้อมูล Landsat จะรวบรวมทุกๆ 16 วันสำหรับฉากที่กำหนดต่อเซ็นเซอร์ แต่บ่อยครั้งที่บางส่วนของรูปภาพถูกบดบังด้วยเมฆ การมาสก์เมฆออกและรวมรูปภาพหลายรูปจากฤดูกาลเดียวกันจะช่วยให้ได้ภาพที่ปราศจากเมฆมากขึ้น ลองพิจารณาตัวอย่างต่อไปนี้ซึ่งภาพ Landsat 5 จากเดือนกรกฎาคมและสิงหาคมจะรวมกันโดยใช้ค่ามัธยฐานของแต่ละปีตั้งแต่ปี 1985 ถึง 2011

ตัวแก้ไขโค้ด (JavaScript)

// Assemble a collection of Landsat surface reflectance images for a given
// region and day-of-year range.
var lsCol = ee.ImageCollection('LANDSAT/LT05/C02/T1_L2')
  .filterBounds(ee.Geometry.Point(-122.9, 43.6))
  .filter(ee.Filter.dayOfYear(182, 243))
  // Add the observation year as a property to each image.
  .map(function(img) {
    return img.set('year', ee.Image(img).date().get('year'));
  });


// Define a function to scale the data and mask unwanted pixels.
function maskL457sr(image) {
  // Bit 0 - Fill
  // Bit 1 - Dilated Cloud
  // Bit 2 - Unused
  // Bit 3 - Cloud
  // Bit 4 - Cloud Shadow
  var qaMask = image.select('QA_PIXEL').bitwiseAnd(parseInt('11111', 2)).eq(0);
  var saturationMask = image.select('QA_RADSAT').eq(0);

  // Apply the scaling factors to the appropriate bands.
  var opticalBands = image.select('SR_B.').multiply(0.0000275).add(-0.2);
  var thermalBand = image.select('ST_B6').multiply(0.00341802).add(149.0);

  // Replace the original bands with the scaled ones and apply the masks.
  return image.addBands(opticalBands, null, true)
      .addBands(thermalBand, null, true)
      .updateMask(qaMask)
      .updateMask(saturationMask);
}

// Define a list of unique observation years from the image collection.
var years = ee.List(lsCol.aggregate_array('year')).distinct().sort();

// Map over the list of years to build a list of annual image composites.
var lsCompList = years.map(function(year) {
  return lsCol
    // Filter image collection by year.
    .filterMetadata('year', 'equals', year)
    // Apply cloud mask.
    .map(maskL457sr)
    // Reduce image collection by median.
    .reduce(ee.Reducer.median())
    // Set composite year as an image property.
    .set('year', year);
});

// Convert the image List to an ImageCollection.
var lsCompCol = ee.ImageCollection.fromImages(lsCompList);

ภาพรวมภายในปีโดยการรวมและลด

โปรดทราบว่าวิธีการจัดองค์ประกอบภาพ 2 วิธีก่อนหน้านี้จะแมปกับListของวันและปีเพื่อกำหนดวันที่ใหม่ที่จะกรองและจัดองค์ประกอบภาพแบบเพิ่มทีละน้อย การใช้การรวมเป็นอีกวิธีหนึ่งในการดำเนินการนี้ ในข้อมูลโค้ดต่อไปนี้ ระบบจะกำหนดคอลเล็กชันปีที่ไม่ซ้ำกัน จากนั้นจะใช้ saveAll join เพื่อระบุรูปภาพทั้งหมดที่สอดคล้องกับปีที่ระบุ รูปภาพของปีหนึ่งๆ จะจัดกลุ่มเป็นออบเจ็กต์ List ซึ่งจัดเก็บเป็นพร็อพเพอร์ตี้ของตัวแทนปีนั้นๆ ในคอลเล็กชันปีที่แยกกัน ภาพรวมรายปีสร้างขึ้นจากรายการเหล่านี้โดยการลด ImageCollections ที่กำหนดไว้ในฟังก์ชันที่แมปกับคอลเล็กชันปีที่แตกต่างกัน

ตัวแก้ไขโค้ด (JavaScript)

// Assemble a collection of Landsat surface reflectance images for a given
// region and day-of-year range.
var lsCol = ee.ImageCollection('LANDSAT/LT05/C02/T1_L2')
  .filterBounds(ee.Geometry.Point(-122.9, 43.6))
  .filter(ee.Filter.dayOfYear(182, 243))
  // Add the observation year as a property to each image.
  .map(function(img) {
    return img.set('year', ee.Image(img).date().get('year'));
  });

// Make a distinct year collection; one image representative per year.
var distinctYears = lsCol.distinct('year').sort('year');

// Define a join filter; one-to-many join on ‘year’ property.
var filter = ee.Filter.equals({leftField: 'year', rightField: 'year'});

// Define a join.
var join = ee.Join.saveAll('year_match');

// Apply the join; results in 'year_match' property being added to each distinct
// year representative image. The list includes all images in the collection
// belonging to the respective year.
var joinCol = join.apply(distinctYears, lsCol, filter);

// Define a function to scale the data and mask unwanted pixels.
function maskL457sr(image) {
  // Bit 0 - Fill
  // Bit 1 - Dilated Cloud
  // Bit 2 - Unused
  // Bit 3 - Cloud
  // Bit 4 - Cloud Shadow
  var qaMask = image.select('QA_PIXEL').bitwiseAnd(parseInt('11111', 2)).eq(0);
  var saturationMask = image.select('QA_RADSAT').eq(0);

  // Apply the scaling factors to the appropriate bands.
  var opticalBands = image.select('SR_B.').multiply(0.0000275).add(-0.2);
  var thermalBand = image.select('ST_B6').multiply(0.00341802).add(149.0);

  // Replace the original bands with the scaled ones and apply the masks.
  return image.addBands(opticalBands, null, true)
      .addBands(thermalBand, null, true)
      .updateMask(qaMask)
      .updateMask(saturationMask);
}

// Map over the distinct years collection to build a list of annual image
// composites.
var lsCompList = joinCol.map(function(img) {
  // Get the list of images belonging to the given year.
  return ee.ImageCollection.fromImages(img.get('year_match'))
    // Apply cloud mask.
    .map(maskL457sr)
    // Reduce image collection by median.
    .reduce(ee.Reducer.median())
    // Set composite year as an image property.
    .copyProperties(img, ['year']);
});

// Convert the image List to an ImageCollection.
var lsCompCol = ee.ImageCollection(lsCompList);

การรวมแบบวันเดียวกันโดยการรวมและลด

กรณีเพิ่มเติมสำหรับการจัดองค์ประกอบคือการสร้างภาพโมเสกที่ต่อเนื่องกันในเชิงพื้นที่ สมมติว่าภูมิภาคที่คุณสนใจครอบคลุมแถว Landsat 2 แถวภายในเส้นทางเดียวกัน และวัตถุประสงค์ของคุณคือการแสดงภาพโมเสกของรูปภาพ 2 รูปสำหรับวงโคจร Landsat 8 แต่ละวงในปี 2017 และ 2018 ในที่นี้ หลังจากกรองคอลเล็กชันตามเส้นทางและแถวแล้ว ระบบจะใช้การดำเนินการรวมเพื่อต่อภาพ Landsat จากวงโคจรเดียวกัน ซึ่งกำหนดโดยวันที่ได้มา

ตัวแก้ไขโค้ด (JavaScript)

var lsCol = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2')
  .filterDate('2017-01-01', '2019-01-01')
  .filter('WRS_PATH == 38 && (WRS_ROW == 28 || WRS_ROW == 29)')
  .map(function(img) {
    var date = img.date().format('yyyy-MM-dd');
    return img.set('date', date);
  });

var distinctDates = lsCol.distinct('date').sort('date');
var filter = ee.Filter.equals({leftField: 'date', rightField: 'date'});
var join = ee.Join.saveAll('date_match');
var joinCol = join.apply(distinctDates, lsCol, filter);

var lsColMos = ee.ImageCollection(joinCol.map(function(col) {
  return ee.ImageCollection.fromImages(col.get('date_match')).mosaic();
}));

จัดเรียง

จัดเรียงคอลเล็กชันตามเวลาเพื่อให้แน่ใจว่าลำดับเวลาถูกต้อง หรือจัดเรียงตามพร็อพเพอร์ตี้ที่คุณเลือก โดยค่าเริ่มต้น ชุดเฟรมการแสดงภาพจะจัดเรียงตามลำดับตามธรรมชาติของคอลเล็กชัน คุณสามารถเปลี่ยนการจัดเรียงชุดข้อมูลได้โดยใช้วิธีการรวบรวม sort ซึ่งจะเลือกพร็อพเพอร์ตี้ Image เพื่อจัดเรียงตามลำดับจากน้อยไปมากหรือมากไปน้อย เช่น หากต้องการจัดเรียงตามเวลาที่สังเกตการณ์ ให้ใช้พร็อพเพอร์ตี้ system:time_start ที่มีอยู่ทั่วไป

ตัวแก้ไขโค้ด (JavaScript)

var s2col = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED')
  .filterBounds(ee.Geometry.Point(-122.1, 37.2))
  .sort('system:time_start');

หรืออาจกำหนดลำดับตามความหนาแน่นของเมฆที่เพิ่มขึ้น เช่นในกรณีของภาพ Sentinel-2 นี้

ตัวแก้ไขโค้ด (JavaScript)

var s2col = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED')
  .filterBounds(ee.Geometry.Point(-122.1, 37.2))
  .sort('CLOUDY_PIXEL_PERCENTAGE');

นอกจากนี้ยังกำหนดลำดับตามพร็อพเพอร์ตี้ที่ดึงมา เช่น NDVI ระดับภูมิภาคเฉลี่ยได้ด้วย ในที่นี้ ระบบจะเพิ่ม NDVI ระดับภูมิภาคเป็นพร็อพเพอร์ตี้ให้กับรูปภาพแต่ละรูปในฟังก์ชันที่แมป ตามด้วยการจัดเรียงพร็อพเพอร์ตี้ใหม่

ตัวแก้ไขโค้ด (JavaScript)

// Define an area of interest geometry.
var aoi = ee.Geometry.Point(-122.1, 37.2).buffer(1e4);

// Filter MODIS NDVI image collection by a date range.
var ndviCol = ee.ImageCollection('MODIS/061/MOD13A1')
  .filterDate('2018-01-01', '2019-01-01')
  .select('NDVI')
  // Map over the image collection to calculate regional mean NDVI and add
  // the result to each image as a property.
  .map(function(img) {
    var meanNdvi = img.reduceRegion({
      reducer: ee.Reducer.mean(), geometry: aoi, scale: 500});
    return img.set('meanNdvi', meanNdvi.get('NDVI'));
  })
  // Sort the collection by descending regional mean NDVI.
  .sort('meanNdvi', false);

การแสดงข้อมูลผ่านภาพ

การแสดงภาพจะเปลี่ยนตัวเลขเป็นสี คุณควบคุมวิธีแสดงข้อมูลรูปภาพเป็นสีในวิธีการแสดงภาพคอลเล็กชันได้ 3 วิธีดังนี้

  1. ระบุอาร์กิวเมนต์การแสดงภาพไปยัง getVideoThumbURL และ getFilmstripThumbURL โดยตรง
  2. แมปเมธอดรูปภาพ visualize กับคอลเล็กชันรูปภาพก่อนใช้ getVideoThumbURL และ getFilmstripThumbURL
  3. แมปเมธอดรูปภาพ sldStyle กับคอลเล็กชันรูปภาพก่อนใช้ getVideoThumbURL และ getFilmstripThumbURL ดูข้อมูลเพิ่มเติมได้ที่ตัวบ่งชี้เลเยอร์ที่มีการจัดรูปแบบ

ตัวอย่างในคู่มือนี้ใช้ตัวเลือกที่ 1 และ 2 ซึ่งการแสดงภาพทำได้โดยการแมปย่านความถี่ของรูปภาพ 3 ย่านของรูปภาพแบบหลายย่านความถี่กับช่องสีแดง เขียว และน้ำเงิน หรือการไล่ระดับค่าของย่านความถี่เดียวในแนวเส้นตรงตามจานสี พารามิเตอร์การแสดงภาพมีดังนี้

พารามิเตอร์การแสดงภาพ
พารามิเตอร์ คำอธิบาย ประเภท
วงดนตรี รายการชื่อย่านความถี่ 3 รายการที่คั่นด้วยคอมมาเพื่อแมปกับ RGB list
นาที ค่าที่จะจับคู่กับ 0 ตัวเลขหรือรายการตัวเลข 3 ตัว โดยแต่ละตัวแทนแต่ละย่านความถี่
max ค่าที่จะแมปกับ 255 ตัวเลขหรือรายการตัวเลข 3 ตัว โดยแต่ละตัวแทนแต่ละย่านความถี่
gain ค่าที่จะคูณค่าพิกเซลแต่ละค่า ตัวเลขหรือรายการตัวเลข 3 ตัว โดยแต่ละตัวแทนแต่ละย่านความถี่
bias ค่าที่จะเพิ่มลงใน DN แต่ละรายการ ตัวเลขหรือรายการตัวเลข 3 ตัว โดยแต่ละตัวแทนแต่ละย่านความถี่
gamma ปัจจัยการแก้ไขแกมมา ตัวเลขหรือรายการตัวเลข 3 ตัว โดยแต่ละตัวแทนแต่ละย่านความถี่
palette รายการสตริงสีสไตล์ CSS (รูปภาพแถบเดียวเท่านั้น) รายการสตริงฐานสิบหกที่คั่นด้วยคอมมา
opacity ความทึบแสงของเลเยอร์ (0.0 คือโปร่งใสทั้งหมด และ 1.0 คือทึบแสงทั้งหมด) ตัวเลข

ใช้อาร์กิวเมนต์ bands เพื่อเลือกย่านความถี่ที่ต้องการแสดงภาพ ระบุรายชื่อวงดนตรี 1 หรือ 3 วง สำหรับรูปภาพแบบหลายย่านความถี่ ระบบจะเลือก 3 ย่านความถี่แรกโดยค่าเริ่มต้น ลำดับชื่อย่านความถี่จะเป็นตัวกำหนดการกำหนดสี โดยย่านความถี่ที่แสดงรายการแรก ที่ 2 และที่ 3 จะแมปกับสีแดง สีเขียว และสีน้ำเงินตามลำดับ

การปรับขนาดช่วงข้อมูลเป็นข้อพิจารณาที่สำคัญเมื่อแสดงภาพ โดยค่าเริ่มต้น ค่าข้อมูลจุดลอยตัวระหว่าง 0 ถึง 1 (รวม) จะปรับขนาดระหว่าง 0 ถึง 255 (รวม) ระบบจะบังคับให้ค่าที่อยู่นอกช่วงนี้เป็น 0 และ 255 โดยขึ้นอยู่กับว่าค่านั้นน้อยกว่า 0 หรือมากกว่า 1 ตามลำดับ สำหรับข้อมูลจำนวนเต็ม ความจุทั้งหมดที่กำหนดโดยประเภทจะปรับขนาดระหว่าง 0 ถึง 255 (เช่น ข้อมูล 16 บิตที่มีเครื่องหมายมีช่วงตั้งแต่ -32,768 ถึง 32,767 ซึ่งปรับขนาดเป็น [0, 255] โดยค่าเริ่มต้น) การยอมรับค่าเริ่มต้นมักส่งผลให้เกิดการแสดงภาพที่มีคอนทราสต์เพียงเล็กน้อยหรือไม่มีเลยระหว่างฟีเจอร์รูปภาพ ใช้ min และ max เพื่อปรับปรุงคอนทราสต์และเน้นช่วงข้อมูลที่เฉพาะเจาะจง หลักการทั่วไปที่ดีคือการตั้งค่า min และ max เป็นค่าที่แสดงเปอร์เซ็นไทล์ที่ 2 และ 98 ของข้อมูลภายในพื้นที่ที่สนใจ ดูตัวอย่างต่อไปนี้ของการคำนวณค่าเหล่านี้สำหรับโมเดลระดับความสูงแบบดิจิทัล

ตัวแก้ไขโค้ด (JavaScript)

// Import NASADEM global elevation model.
var demImg = ee.Image('NASA/NASADEM_HGT/001').select('elevation');

// Define a rectangular area of interest.
var aoi = ee.Geometry.Polygon(
  [[
    [-103.84153083119054, 49.083004219142886],
    [-103.84153083119054, 25.06838270664608],
    [-85.64817145619054, 25.06838270664608],
    [-85.64817145619054, 49.083004219142886]
  ]],
  null, false);

// Calculate the 2nd and 98th percentile elevation values from rescaled (to
// 500m) pixels intersecting the area of interest. A Dictionary is returned.
var percentClip = demImg.reduceRegion({
  reducer: ee.Reducer.percentile([2, 98]),
  geometry: aoi,
  scale: 500,
  maxPixels: 3e7
});

// Print the regional 2nd and 98th percentile elevation values. Get the
// dictionary keys and use them to get the values for each percentile summary.
var keys = percentClip.keys();
print('Set vis min to:', ee.Number(percentClip.get(keys.get(0))).round());
print('Set vis max to:', ee.Number(percentClip.get(keys.get(1))).round());

พารามิเตอร์ palette จะกำหนดสีเพื่อแสดงรูปภาพการแสดงข้อมูลผ่านภาพแบบ 8 บิต โดยจะใช้กับการแสดงผลแบบแบนด์เดียวเท่านั้น การระบุด้วยรูปภาพแบบหลายแบนด์จะทำให้เกิดข้อผิดพลาด หากข้อมูลเป็นแบบแบนด์เดียวหรือคุณต้องการแสดงภาพแบนด์เดียวจากรูปภาพแบบหลายแบนด์ ให้ตั้งค่าพารามิเตอร์ forceRgbOutput เป็น true (ไม่จำเป็นหากระบุอาร์กิวเมนต์ palette) ใช้พารามิเตอร์ min และ max เพื่อกำหนดช่วงของค่าที่จะปรับขนาดเชิงเส้นระหว่าง 0 ถึง 255

ตัวอย่างการแมปฟังก์ชันการแสดงภาพกับคอลเล็กชันรูปภาพแบบแบนด์เดียวมีดังนี้ ระบบจะนำเข้าคอลเล็กชัน MODIS NDVI, ตั้งค่าอาร์กิวเมนต์การแสดงภาพสำหรับเมธอด visualization และแมปฟังก์ชันที่เปลี่ยนค่าเป็นการแสดงภาพ RGB ผ่านคอลเล็กชัน NDVI

ตัวแก้ไขโค้ด (JavaScript)

// Filter MODIS NDVI image collection by a date range.
var ndviCol = ee.ImageCollection('MODIS/061/MOD13A1')
  .filterDate('2018-01-01', '2019-01-01')
  .select('NDVI');

// Define visualization arguments.
var visArgs = {
  min: 0,
  max: 9000,
  palette: [
    'FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901',
    '66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01',
    '012E01', '011D01', '011301'
  ]
};

// Define a function to convert an image to an RGB visualization image and copy
// properties from the original image to the RGB image.
var visFun = function(img) {
  return img.visualize(visArgs).copyProperties(img, img.propertyNames());
};

// Map over the image collection to convert each image to an RGB visualization
// using the previously defined visualization function.
var ndviColVis = ndviCol.map(visFun);

ต่อไปนี้คือตัวอย่างการแมปฟังก์ชันการแสดงภาพกับคอลเล็กชันรูปภาพแบบหลายย่านความถี่

ตัวแก้ไขโค้ด (JavaScript)

// Assemble a collection of Sentinel-2 surface reflectance images for a given
// region and date range.
var s2col = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED')
  .filterBounds(ee.Geometry.Point(-96.9037, 48.0395))
  .filterDate('2019-06-01', '2019-10-01');

// Define visualization arguments.
var visArgs = {bands: ['B11', 'B8', 'B3'], min: 300, max: 3500};

// Define a function to convert an image to an RGB visualization image and copy
// properties from the original image to the RGB image.
var visFun = function(img) {
  return img.visualize(visArgs).copyProperties(img, img.propertyNames());
};

// Map over the image collection to convert each image to an RGB visualization
// using the previously defined visualization function.
var s2colVis = s2col.map(visFun);

ในกรณีนี้ ไม่มีการระบุอาร์กิวเมนต์จานสีเนื่องจากมี 3 แบนด์ ซึ่งกำหนดความเข้มสำหรับแต่ละเลเยอร์ RGB โปรดทราบว่าทั้ง 2 ตัวอย่างใช้พารามิเตอร์ min และ max เพื่อควบคุมค่าที่ขยายไปยังขีดจำกัดของข้อมูล RGB แบบ 8 บิต

ภาพปกวิดีโอ

ฟังก์ชัน getVideoThumbURL() จะสร้างภาพเคลื่อนไหวจากรูปภาพทั้งหมดใน ImageCollection โดยที่รูปภาพแต่ละรูปจะแสดงเฟรม เวิร์กโฟลว์ทั่วไปสำหรับการสร้างภาพเคลื่อนไหวมีดังนี้

  1. กำหนด Geometry ที่มีขอบเขตซึ่งกำหนดขอบเขตระดับภูมิภาคของภาพเคลื่อนไหว
  2. กำหนด ImageCollection
  3. พิจารณาการแสดงภาพ: แมปฟังก์ชันการแสดงภาพกับคอลเล็กชันหรือเพิ่มอาร์กิวเมนต์การแสดงภาพลงในชุดอาร์กิวเมนต์ภาพเคลื่อนไหว
  4. กำหนดอาร์กิวเมนต์ของภาพเคลื่อนไหวและเรียกใช้เมธอด getVideoThumbURL

ผลลัพธ์ของ getVideoThumbURL คือ URL พิมพ์ URL ไปยังคอนโซล แล้วคลิกเพื่อเริ่มเซิร์ฟเวอร์ Earth Engine ที่สร้างภาพเคลื่อนไหวแบบเรียลไทม์ในแท็บเบราว์เซอร์ใหม่ หรือจะดูภาพเคลื่อนไหวในคอนโซลตัวแก้ไขโค้ดโดยเรียกใช้ฟังก์ชัน ui.Thumbnail ในคอลเล็กชันและอาร์กิวเมนต์ภาพเคลื่อนไหวที่เกี่ยวข้องก็ได้ เมื่อแสดงผลแล้ว คุณจะดาวน์โหลดภาพเคลื่อนไหวได้โดยคลิกขวาที่ภาพเคลื่อนไหว แล้วเลือกตัวเลือกที่เหมาะสมจากเมนูตามบริบท

ตัวอย่างต่อไปนี้แสดงการสร้างภาพเคลื่อนไหวที่แสดงอุณหภูมิโลกในช่วง 24 ชั่วโมง โปรดทราบว่าตัวอย่างนี้รวมอาร์กิวเมนต์การแสดงภาพพร้อมกับอาร์กิวเมนต์ภาพเคลื่อนไหว ซึ่งตรงข้ามกับการแมปฟังก์ชันการแสดงภาพกับ ImageCollection ก่อน เมื่อเรียกใช้สคริปต์นี้ ภาพเคลื่อนไหวที่คล้ายกับรูปที่ 3 ควรปรากฏในคอนโซลตัวแก้ไขโค้ด

ตัวแก้ไขโค้ด (JavaScript)

// Define an area of interest geometry with a global non-polar extent.
var aoi = ee.Geometry.Polygon(
  [[[-179.0, 78.0], [-179.0, -58.0], [179.0, -58.0], [179.0, 78.0]]], null,
  false);

// Import hourly predicted temperature image collection for northern winter
// solstice. Note that predictions extend for 384 hours; limit the collection
// to the first 24 hours.
var tempCol = ee.ImageCollection('NOAA/GFS0P25')
  .filterDate('2018-12-22', '2018-12-23')
  .limit(24)
  .select('temperature_2m_above_ground');

// Define arguments for animation function parameters.
var videoArgs = {
  dimensions: 768,
  region: aoi,
  framesPerSecond: 7,
  crs: 'EPSG:3857',
  min: -40.0,
  max: 35.0,
  palette: ['blue', 'purple', 'cyan', 'green', 'yellow', 'red']
};

// Print the animation to the console as a ui.Thumbnail using the above defined
// arguments. Note that ui.Thumbnail produces an animation when the first input
// is an ee.ImageCollection instead of an ee.Image.
print(ui.Thumbnail(tempCol, videoArgs));

// Alternatively, print a URL that will produce the animation when accessed.
print(tempCol.getVideoThumbURL(videoArgs));


รูปที่ 3 อุณหภูมิพื้นผิวรายชั่วโมงสำหรับเหมายันในซีกโลกเหนือที่แสดงเป็น GIF ภาพเคลื่อนไหว

แถบฟิล์ม

ฟังก์ชัน getFilmstripThumbUrl จะสร้างภาพนิ่งภาพเดียวที่แสดงการเชื่อมโยงรูปภาพทั้งหมดใน ImageCollection เป็นชุดภาพเหนือ-ใต้ ลำดับของเฟรมในแถบแสดงตัวอย่างรูปภาพจะเป็นไปตามลำดับตามธรรมชาติของคอลเล็กชัน

ผลลัพธ์ของ getFilmstripThumbUrl คือ URL พิมพ์ URL ไปยังคอนโซล แล้วคลิกเพื่อเริ่มเซิร์ฟเวอร์ Earth Engine ที่สร้างรูปภาพแบบเรียลไทม์ในแท็บเบราว์เซอร์ใหม่ เมื่อแสดงผลแล้ว คุณจะดาวน์โหลดรูปภาพได้โดยคลิกขวาที่รูปภาพแล้วเลือกตัวเลือกที่เหมาะสมจากเมนูตามบริบท

ข้อมูลโค้ดต่อไปนี้ใช้คอลเล็กชันเดียวกับตัวอย่างภาพขนาดย่อของวิดีโอด้านบน เมื่อเรียกใช้สคริปต์นี้ แถบแสดงตัวอย่างรูปภาพที่คล้ายกับรูปที่ 4 ควรปรากฏในคอนโซลตัวแก้ไขโค้ด

ตัวแก้ไขโค้ด (JavaScript)

// Define an area of interest geometry with a global non-polar extent.
var aoi = ee.Geometry.Polygon(
  [[[-179.0, 78.0], [-179.0, -58.0], [179.0, -58.0], [179.0, 78.0]]], null,
  false);

// Import hourly predicted temperature image collection for northern winter
// solstice. Note that predictions extend for 384 hours; limit the collection
// to the first 24 hours.
var tempCol = ee.ImageCollection('NOAA/GFS0P25')
  .filterDate('2018-12-22', '2018-12-23')
  .limit(24)
  .select('temperature_2m_above_ground');

// Define arguments for the getFilmstripThumbURL function parameters.
var filmArgs = {
  dimensions: 128,
  region: aoi,
  crs: 'EPSG:3857',
  min: -40.0,
  max: 35.0,
  palette: ['blue', 'purple', 'cyan', 'green', 'yellow', 'red']
};

// Print a URL that will produce the filmstrip when accessed.
print(tempCol.getFilmstripThumbURL(filmArgs));


รูปที่ 4 อุณหภูมิพื้นผิวรายชั่วโมงสำหรับเหมายันในซีกโลกเหนือที่แสดงเป็นรูปภาพ PNG แบบแถบแสดงตัวอย่างรูปภาพ โปรดทราบว่าแถบแสดงตัวอย่างรูปภาพได้ถูกแบ่งออกเป็น 4 ส่วนเพื่อแสดงผล ผลลัพธ์ของ getFilmstripThumbURL คือชุดรูปภาพคอลเล็กชันชุดเดียวที่เชื่อมต่อกันจากเหนือไปใต้

เทคนิคขั้นสูง

ส่วนต่อไปนี้จะอธิบายวิธีใช้การตัด การปรับความทึบแสง และการจัดองค์ประกอบเลเยอร์เพื่อปรับปรุงการแสดงภาพโดยการเพิ่มขอบรูปหลายเหลี่ยม เน้นพื้นที่ที่สนใจ และเปรียบเทียบรูปภาพภายในคอลเล็กชัน

โปรดทราบว่าตัวอย่างต่อไปนี้ทั้งหมดในส่วนนี้ใช้ ImageCollection พื้นฐานเดียวกันซึ่งกำหนดไว้ที่นี่

ตัวแก้ไขโค้ด (JavaScript)

// Import hourly predicted temperature image collection for northern winter
// solstice. Note that predictions extend for 384 hours; limit the collection
// to the first 24 hours.
var tempCol = ee.ImageCollection('NOAA/GFS0P25')
  .filterDate('2018-12-22', '2018-12-23')
  .limit(24)
  .select('temperature_2m_above_ground');

// Define visualization arguments to control the stretch and color gradient
// of the data.
var visArgs = {
  min: -40.0,
  max: 35.0,
  palette: ['blue', 'purple', 'cyan', 'green', 'yellow', 'red']
};

// Convert each image to an RGB visualization image by mapping the visualize
// function over the image collection using the arguments defined previously.
var tempColVis = tempCol.map(function(img) {
  return img.visualize(visArgs);
});

// Import country features and filter to South American countries.
var southAmCol = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017')
  .filterMetadata('wld_rgn', 'equals', 'South America');

// Define animation region (South America with buffer).
var southAmAoi = ee.Geometry.Rectangle({
  coords: [-103.6, -58.8, -18.4, 17.4], geodesic: false});

การวางซ้อน

คุณวางซ้อนรูปภาพหลายรูปได้โดยใช้เมธอด blend Image ซึ่งพิกเซลที่ทับซ้อนกันจากรูปภาพ 2 รูปจะผสมกันตามมาสก์ (ความทึบแสง)

การวางซ้อนเวกเตอร์

การเพิ่มรูปหลายเหลี่ยมของขอบเขตการปกครองและเรขาคณิตอื่นๆ ลงในรูปภาพจะช่วยให้บริบทเชิงพื้นที่ที่มีคุณค่าได้ ลองพิจารณาภาพเคลื่อนไหวของอุณหภูมิพื้นผิวรายวันทั่วโลกด้านบน (รูปที่ 3) ขอบเขตระหว่างแผ่นดินและมหาสมุทรนั้นมองเห็นได้ค่อนข้างชัดเจน แต่สามารถทำให้ชัดเจนยิ่งขึ้นได้โดยการเพิ่มการวางซ้อนรูปหลายเหลี่ยมของประเทศต่างๆ

ระบบจะวาดข้อมูลเวกเตอร์ (Features) เป็นรูปภาพโดยใช้วิธี paint คุณสามารถวาดฟีเจอร์ลงในรูปภาพที่มีอยู่ได้ แต่แนวทางปฏิบัติที่ดีกว่าคือวาดฟีเจอร์ลงในรูปภาพเปล่า จัดรูปแบบ แล้วผสมผสานผลลัพธ์กับเลเยอร์รูปภาพที่มีการจัดรูปแบบอื่นๆ การจัดการเลเยอร์แต่ละชั้นของสแต็กการแสดงภาพแยกกันจะช่วยให้ควบคุมการจัดสไตล์ได้มากขึ้น

ตัวอย่างต่อไปนี้แสดงการวาดเส้นขอบประเทศในอเมริกาใต้ลงใน Image เปล่า และผสมผสานผลลัพธ์กับ Image แต่ละรายการของคอลเล็กชันอุณหภูมิรายวันทั่วโลก (รูปที่ 5) ขอบเขตประเทศที่วางซ้อนกันจะแยกแผ่นดินออกจากน้ำและให้บริบทเกี่ยวกับรูปแบบของอุณหภูมิ

ตัวแก้ไขโค้ด (JavaScript)

// Define an empty image to paint features to.
var empty = ee.Image().byte();

// Paint country feature edges to the empty image.
var southAmOutline = empty
  .paint({featureCollection: southAmCol, color: 1, width: 1})
  // Convert to an RGB visualization image; set line color to black.
  .visualize({palette: '000000'});

// Map a blend operation over the temperature collection to overlay the country
// border outline image on all collection images.
var tempColOutline = tempColVis.map(function(img) {
  return img.blend(southAmOutline);
});

// Define animation arguments.
var videoArgs = {
  dimensions: 768,
  region: southAmAoi,
  framesPerSecond: 7,
  crs: 'EPSG:3857'
};

// Display the animation.
print(ui.Thumbnail(tempColOutline, videoArgs));


รูปที่ 5 เพิ่มการวางซ้อนเวกเตอร์ลงในรูปภาพในคอลเล็กชันเพื่อให้บริบทเชิงพื้นที่

ภาพที่วางซ้อน

คุณสามารถวางซ้อนรูปภาพหลายรูปเพื่อให้ได้สไตล์ที่ต้องการ สมมติว่าคุณต้องการเน้นบริเวณที่สนใจ คุณสามารถสร้างสำเนาภาพที่แสดงข้อมูลผ่านภาพแบบปิดเสียงเป็นเลเยอร์ฐาน แล้ววางซ้อนเวอร์ชันที่ตัดคลิปของการแสดงข้อมูลผ่านภาพต้นฉบับ สคริปต์ต่อไปนี้สร้างรูปที่ 6 โดยต่อยอดจากตัวอย่างก่อนหน้า

ตัวแก้ไขโค้ด (JavaScript)

// Define an empty image to paint features to.
var empty = ee.Image().byte();

// Paint country feature edges to the empty image.
var southAmOutline = empty
  .paint({featureCollection: southAmCol, color: 1, width: 1})
  // Convert to an RGB visualization image; set line color to black.
  .visualize({palette: '000000'});

// Map a blend operation over the temperature collection to overlay the country
// border outline image on all collection images.
var tempColOutline = tempColVis.map(function(img) {
  return img.blend(southAmOutline);
});

// Define a partially opaque grey RGB image to dull the underlying image when
// blended as an overlay.
var dullLayer = ee.Image.constant(175).visualize({
  opacity: 0.6, min: 0, max: 255, forceRgbOutput: true});

// Map a two-part blending operation over the country outline temperature
// collection for final styling.
var finalVisCol = tempColOutline.map(function(img) {
  return img
    // Blend the dulling layer with the given country outline temperature image.
    .blend(dullLayer)
    // Blend a clipped copy of the country outline temperature image with the
    // dulled background image.
    .blend(img.clipToCollection(southAmCol));
});

// Define animation arguments.
var videoArgs = {
  dimensions: 768,
  region: southAmAoi,
  framesPerSecond: 7,
  crs: 'EPSG:3857'
};

// Display the animation.
print(ui.Thumbnail(finalVisCol, videoArgs));


รูปที่ 6 เน้นพื้นที่ที่น่าสนใจโดยการครอบตัดรูปภาพและวางซ้อนบนสำเนาที่ปิดเสียงไว้

นอกจากนี้ คุณยังผสมผสานข้อมูลรูปภาพกับเลเยอร์ฐานการแรเงาตามความสูงเพื่อระบุภูมิประเทศและทำให้การแสดงภาพมีความลึกได้ด้วย (รูปที่ 7)

ตัวแก้ไขโค้ด (JavaScript)

// Define a hillshade layer from NASADEM digital elevation model.
var hillshade = ee.Terrain.hillshade(ee.Image('NASA/NASADEM_HGT/001')
  // Exaggerate the elevation to increase contrast in hillshade.
  .multiply(100))
  // Clip the DEM by South American boundary to clean boundary between
  // land and ocean.
  .clipToCollection(southAmCol);

// Map a blend operation over the temperature collection to overlay a partially
// opaque temperature layer on the hillshade layer.
var finalVisCol = tempColVis.map(function(img) {
  return hillshade
    .blend(img.clipToCollection(southAmCol).visualize({opacity: 0.6}));
});

// Define animation arguments.
var videoArgs = {
  dimensions: 768,
  region: southAmAoi,
  framesPerSecond: 7,
  crs: 'EPSG:3857'
};

// Display the animation.
print(ui.Thumbnail(finalVisCol, videoArgs));


รูปที่ 7 แสดงภูมิประเทศโดยวางซ้อนข้อมูลรูปภาพที่โปร่งใสบางส่วนบนเลเยอร์การไล่ระดับสีตามความสูง

ทรานซิชัน

ปรับแต่งคอลเล็กชันรูปภาพเพื่อสร้างภาพเคลื่อนไหวที่แสดงความแตกต่างระหว่างรูปภาพ 2 รูปภายในคอลเล็กชันโดยใช้การเปลี่ยนภาพแบบจางลง กะพริบ และเลื่อน ตัวอย่างต่อไปนี้แต่ละรายการใช้การแสดงภาพพื้นฐานเดียวกันซึ่งสร้างโดยสคริปต์ต่อไปนี้

ตัวแก้ไขโค้ด (JavaScript)

// Define an area of interest geometry with a global non-polar extent.
var aoi = ee.Geometry.Polygon(
  [[[-179.0, 78.0], [-179.0, -58.0], [179.0, -58.0], [179.0, 78.0]]], null,
  false);

// Import hourly predicted temperature image collection.
var temp = ee.ImageCollection('NOAA/GFS0P25')

// Define a northern summer solstice temperature image.
var summerSolTemp = temp
  .filterDate('2018-06-21', '2018-06-22')
  .filterMetadata('forecast_hours', 'equals', 12)
  .first()
  .select('temperature_2m_above_ground');

// Define a northern winter solstice temperature image.
var winterSolTemp = temp
  .filterDate('2018-12-22', '2018-12-23')
  .filterMetadata('forecast_hours', 'equals', 12)
  .first()
  .select('temperature_2m_above_ground');

// Combine the solstice images into a collection.
var tempCol = ee.ImageCollection([
  summerSolTemp.set('season', 'summer'),
  winterSolTemp.set('season', 'winter')
]);

// Import international boundaries feature collection.
var countries = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017');

// Define visualization arguments.
var visArgs = {
  min: -40.0,
  max: 35.0,
  palette: ['blue', 'purple', 'cyan', 'green', 'yellow', 'red']
};

// Convert the image data to RGB visualization images.
// The clip and unmask combination sets ocean pixels to black.
var tempColVis = tempCol.map(function(img) {
  return img
    .visualize(visArgs)
    .clipToCollection(countries)
    .unmask(0)
    .copyProperties(img, img.propertyNames());
});

กะพริบ

เมื่อมีรูปภาพเพียง 2 รูปในคอลเล็กชัน เช่นในกรณีนี้ การกะพริบจะเป็นการแสดงภาพเริ่มต้นเมื่อสร้างภาพเคลื่อนไหวจากคอลเล็กชัน ปรับอาร์กิวเมนต์ภาพเคลื่อนไหว framesPerSecond เพื่อเร่งหรือชะลออัตราการกะพริบ อาร์กิวเมนต์การแสดงภาพต่อไปนี้ที่ใช้กับคอลเล็กชันด้านบนจะสร้างรูปที่ 8

ตัวแก้ไขโค้ด (JavaScript)

// Define arguments for animation function parameters.
var videoArgs = {
  dimensions: 768,
  region: aoi,
  framesPerSecond: 2,
  crs: 'EPSG:3857'
};

// Display animation to the Code Editor console.
print(ui.Thumbnail(tempColVis, videoArgs));


รูปที่ 8 ตัวอย่างการสลับไปมาระหว่างอุณหภูมิพื้นผิวเวลา 12:00 น. GMT สำหรับเหมายันและครีษมายัน

จาง

การเปลี่ยนภาพแบบจางลงระหว่าง 2 เลเยอร์ทำได้โดยการลดความทึบแสงของเลเยอร์หนึ่งพร้อมกับเพิ่มความทึบแสงของอีกเลเยอร์หนึ่งตามลำดับการเพิ่มความทึบแสงจากใกล้ 0 เป็น 1 (รูปที่ 9)

ตัวแก้ไขโค้ด (JavaScript)

// Define a sequence of decreasing opacity increments. Note that opacity cannot
// be 0, so near 1 and 0 are used. Near 1 is needed because a compliment is
// calculated in a following step that can result in 0 if 1 is an element of the
// list.
var opacityList = ee.List.sequence({start: 0.99999, end: 0.00001, count: 20});

// Filter the summer and winter solstice images from the collection and set as
// image objects.
var summerImg = tempColVis.filter(ee.Filter.eq('season', 'summer')).first();
var winterImg = tempColVis.filter(ee.Filter.eq('season', 'winter')).first();

// Map over the list of opacity increments to iteratively adjust the opacity of
// the two solstice images. Returns a list of images.
var imgList = opacityList.map(function(opacity) {
  var opacityCompliment = ee.Number(1).subtract(ee.Number(opacity));
  var winterImgFade = winterImg.visualize({opacity: opacity});
  var summerImgFade = summerImg.visualize({opacity: opacityCompliment});
  return summerImgFade.blend(winterImgFade).set('opacity', opacity);
});

// Convert the image list to an image collection; the forward phase.
var fadeForward = ee.ImageCollection.fromImages(imgList);

// Make a copy of the collection that is sorted by ascending opacity to
// represent the reverse phase.
var fadeBackward = fadeForward.sort({property: 'opacity'});

// Merge the forward and reverse phase frame collections.
var fadeCol = fadeForward.merge(fadeBackward);

// Define animation arguments.
var videoArgs = {
  dimensions: 768,
  region: aoi,
  framesPerSecond: 25,
  crs: 'EPSG:3857'
};

// Display the animation.
print(ui.Thumbnail(fadeCol, videoArgs));


รูปที่ 9 ตัวอย่างการเฟดระหว่างอุณหภูมิพื้นผิวเวลา 12:00 น. (GMT) สำหรับครีษมายันและเหมายัน

แถบเลื่อน

การเปลี่ยนแบบแถบเลื่อนจะแสดงและซ่อนเลเยอร์รูปภาพที่อยู่ด้านล่างอย่างต่อเนื่อง ซึ่งทำได้โดยการปรับความทึบแสงของรูปภาพที่วางซ้อนกันซ้ำๆ ในช่วงลองจิจูดต่างๆ (รูปที่ 10)

ตัวแก้ไขโค้ด (JavaScript)

// Define a sequence of longitude increments. Start and end are defined by the
// min and max longitude of the feature to be provided to the region parameter
// of the animation arguments dictionary.
var lonSeq = ee.List.sequence({start: -179, end: 179, count: 20});

// Define a longitude image.
var longitude = ee.Image.pixelLonLat().select('longitude');

// Filter the summer and winter solstice images from the collection and set as
// image objects.
var summerImg = tempColVis.filter(ee.Filter.eq('season', 'summer')).first();
var winterImg = tempColVis.filter(ee.Filter.eq('season', 'winter')).first();

// Map over the list of longitude increments to iteratively adjust the mask
// (opacity) of the overlying image layer. Returns a list of images.
var imgList = lonSeq.map(function(lon) {
  lon = ee.Number(lon);
  var mask = longitude.gt(lon);
  return summerImg.blend(winterImg.updateMask(mask)).set('lon', lon);
});

// Convert the image list to an image collection; concealing phase.
var sliderColForward = ee.ImageCollection.fromImages(imgList);

// Make a copy of the collection that is sorted by descending longitude to
// represent the revealing phase.
var sliderColbackward = sliderColForward
  .sort({property: 'lon', ascending: false});

// Merge the forward and backward phase frame collections.
var sliderCol = sliderColForward.merge(sliderColbackward);

// Define animation arguments.
var videoArgs = {
  dimensions: 768,
  region: aoi,
  framesPerSecond: 25,
  crs: 'EPSG:3857'
};

// Display the animation.
print(ui.Thumbnail(sliderCol, videoArgs));


รูปที่ 10 ตัวอย่างการเปลี่ยนภาพแบบเลื่อนระหว่างอุณหภูมิพื้นผิวเวลา 12:00 น. (GMT) สำหรับช่วงครีษมายันและเหมายัน