Học Google Earth Engine 8 – Thêm dữ liệu vào GEE – Import data

Học Google Earth Engine 8. Thêm dữ liệu vào GEE – Import data

3.6. Thêm dữ liệu vào GEE – Importing Data

Bạn có thể nhập dữ liệu vectơ hoặc raster vào Earth Engine. Bây giờ chúng tôi sẽ nhập một tệp hình dạng của Khu vực đô thị cho Trái đất tự nhiên. Giải nén ne_10m_urban_areas.zip vào một thư mục trên máy tính của bạn. Trong Trình chỉnh sửa mã, đi tới Assets → New → Table Upload → Shape Files

Chọn các tệp .shp, .shx, .dbf và .prj. Nhập Asset Name là  ne_10m_urban_areas và tải lên. Sau khi quá trình tải lên và nhập kết thúc, bạn sẽ có một nội dung mới trong tab Nội dung. Tệp hình dạng được nhập dưới dạng Bộ sưu tập tính năng trong Earth Engine. Chọn nội dung ne_10m_urban_areas và nhấp vào Import. Sau đó, bạn có thể trực quan hóa dữ liệu đã nhập (Visualize).

Thêm 1 .shp file vào GEE

// Let’s import some data to Earth Engine

// Upload the ne_10m_urban_areas.shp shapefile

// Import the collection

var urban = ee.FeatureCollection(“users/ujavalgandhi/e2e/ne_10m_urban_areas”);

// Visualize the collection

Map.addLayer(urban, {color: ‘blue’}, ‘Urban Areas’)

3.6.1. Bài tập

// Apply a filter to select only large urban areas

// Use the property ‘area_sqkm’ and select all features 

// with area > 400 sq.km

// Áp dụng bộ lọc để chỉ chọn các khu vực đô thị lớn

// Sử dụng thuộc tính ‘area_sqkm’ và chọn tất cả các tính năng

// với diện tích> 400 sq.km

var urban = ee.FeatureCollection(“users/ujavalgandhi/e2e/ne_10m_urban_areas”);

3.6.2. Kết quả

// Apply a filter to select only large urban areas

// Use the property ‘area_sqkm’ and select all features 

// with area > 400 sq.km

// Áp dụng bộ lọc để chỉ chọn các khu vực đô thị lớn

// Sử dụng thuộc tính ‘area_sqkm’ và chọn tất cả các tính năng

// với diện tích> 400 sq.km

// Import the collection

var urban = ee.FeatureCollection(“users/ujavalgandhi/e2e/ne_10m_urban_areas”);

// print(urban.limit(5)); Lệnh này để xem các thuộc tính của file urban

var urbanfilter = urban.filter(ee.Filter.gt(‘area_sqkm’, 400)); //gt là greater than – lớn hơn

// Visualize the collection

Map.addLayer(urbanfilter, {color: ‘blue’}, ‘Urban Areas > 400’);

Map.centerObject(urbanfilter, 8)

Recommended For You

About the Author: Admin