
Học Google Earth Engine 11. Bài tập thực hành Earth Engine Basics 1
3.9. Bài tập – Assignment 1
// Assignment
// Export the Night Lights images for May,2015 and May,2020
// Workflow:
// Load the VIIRS Nighttime Day/Night Band Composites collection
// Filter the collection to the date range
// Extract the ‘avg_rad’ band which represents the nighttime lights
// Clip the image to the geometry of your city
// Export the resulting image as a GeoTIFF file.
// Hint1:
// There are 2 VIIRS Nighttime Day/Night collections
// Use the one that corrects for stray light
// Hint2:
// The collection contains 1 global image per month
// After filtering for the month, there will be only 1 image in the collection
// You can use the following technique to extract that image
// var image = ee.Image(filtered.first())
// Bài tập
// Xuất ảnh Night Lights cho tháng 5 năm 2015 và tháng 5 năm 2020
// Quy trình làm việc:
// Tải bộ sưu tập VIIRS Nighttime Day/Night Band Composites collection
// Lọc bộ sưu tập theo phạm vi ngày
// Trích xuất dải ‘avg_rad’ đại diện cho đèn ban đêm
// Cắt hình ảnh theo geometry của thành phố của bạn
// Xuất hình ảnh kết quả dưới dạng tệp GeoTIFF.
// Gợi ý 1:
// Có 2 bộ sưu tập VIIRS Nighttime Day/Night
// Sử dụng một điều chỉnh cho ánh sáng
// Gợi ý 2:
// Bộ sưu tập chứa 1 hình ảnh toàn cầu mỗi tháng
// Sau khi lọc tháng, sẽ chỉ có 1 ảnh duy nhất trong bộ sưu tập
// Bạn có thể sử dụng kỹ thuật sau để trích xuất hình ảnh đó
// var image = ee.Image (filter.first ())
Assignment1 Expected Output
3.10. Kết quả
// Assignment
// Export the Night Lights images for May,2015 and May,2020
// Workflow:
// Load the VIIRS Nighttime Day/Night Band Composites collection
// Filter the collection to the date range
// Extract the ‘avg_rad’ band which represents the nighttime lights
// Clip the image to the geometry of your city
// Export the resulting image as a GeoTIFF file.
var urban = ee.FeatureCollection(“users/ujavalgandhi/e2e/ne_10m_urban_areas”)
var filtered = urban.filter(ee.Filter.eq(‘system:index’, ‘00000000000000000983’)) //Sửa thành 00000000000000000983 để có khu vực Hà Nội
var geometry = filtered.geometry()
var dataset = ee.ImageCollection(‘NOAA/VIIRS/DNB/MONTHLY_V1/VCMCFG’)
.filter(ee.Filter.date(‘2015-05-01’, ‘2020-05-31’))
var image = ee.Image(dataset.first());
print(image)
var nighttime1 = image.select(‘avg_rad’);
var nighttime = nighttime1.clip(geometry);
var nighttimeVis = {min: 0.0, max: 60.0};
Map.centerObject(geometry, 10);
Map.addLayer(nighttime, nighttimeVis, ‘Nighttime’);
Export.image.toDrive({
image: nighttime,
description: ‘nighttime2015’,
folder: ‘@earthengine’,
fileNamePrefix: ‘nighttime2015’,
region: geometry,
scale: 20,
maxPixels: 1e9
})
Kết quả trên Drive
Xem video hướng dẫn