Earth Engine sẽ giới thiệu
các bậc hạn mức phi thương mại để bảo vệ các tài nguyên điện toán dùng chung và đảm bảo hiệu suất đáng tin cậy cho mọi người. Tất cả các dự án phi thương mại đều cần chọn một cấp hạn mức muộn nhất vào
ngày 27 tháng 4 năm 2026, nếu không sẽ sử dụng Cấp cộng đồng theo mặc định. Hạn mức theo cấp sẽ có hiệu lực đối với tất cả các dự án (bất kể ngày chọn cấp) từ
ngày 27 tháng 4 năm 2026.
Tìm hiểu thêm.
ee.Terrain.aspect
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Tính toán hướng dốc theo độ từ DEM địa hình.
Độ dốc cục bộ được tính bằng cách sử dụng 4 điểm lân cận được kết nối của mỗi pixel, vì vậy, các giá trị bị thiếu sẽ xuất hiện xung quanh các cạnh của hình ảnh.
| Cách sử dụng | Giá trị trả về |
|---|
ee.Terrain.aspect(input) | Hình ảnh |
| Đối số | Loại | Thông tin chi tiết |
|---|
input | Hình ảnh | Hình ảnh độ cao, tính bằng mét. |
Ví dụ
Trình soạn thảo mã (JavaScript)
// Demonstrate ee.Terrain functions with single-image and collection DEMs.
// DEMs in Earth Engine are often distributed as single images per asset
// (e.g., NASA/NASADEM_HGT/001) or as collections of tiled images that need
// to be mosaicked (e.g., COPERNICUS/DEM/GLO30). Terrain analysis functions
// compute values based on neighboring pixels, so care must be taken to
// select and prepare DEM inputs appropriately.
// 1. Single DEM image asset.
// Assets like NASADEM are presented as single images covering large areas.
// They generally have a single projection and can be used in terrain analysis
// with no preprocessing.
var nasadem = ee.Image('NASA/NASADEM_HGT/001').select('elevation');
// Calculate aspect: degrees, 0=N, 90=E, 180=S, 270=W.
var nasademAspect = ee.Terrain.aspect(nasadem);
// Visualization parameters.
var elevationVis = {
min: 0.0,
max: 3000.0,
palette:
['333399', '00a2e5', '55dd77', 'ffff99', 'aa926b', 'aa928d', 'ffffff']
};
var aspectVis = {min: 0.0, max: 359.99};
// Display layers.
Map.setCenter(-121.603, 47.702, 9);
Map.addLayer(nasadem, elevationVis, 'NASADEM Elevation', false);
Map.addLayer(nasademAspect, aspectVis, 'NASADEM Aspect');
// 2. Mosaicked DEM ImageCollection asset.
// In contrast to single-image assets like NASADEM, some DEMs like GLO30 are
// provided as a collection of images that need to be mosaicked before use.
// We use this mosaicked DEM for the terrain calculations below.
var glo30collection = ee.ImageCollection('COPERNICUS/DEM/GLO30');
// When mosaicking a DEM collection that will be used for terrain analysis,
// it is best practice to set the mosaic's default projection to the native
// projection of the DEM tiles. If you don't, Earth Engine's default
// projection for mosaics (EPSG:4326 at 1-degree scale) is used, which is
// often too coarse for analysis and can lead to resampling artifacts if
// the result is reprojected to a different CRS during computation.
// See:
// https://developers.google.com/earth-engine/guides/projections#reprojecting
var glo30Proj = glo30collection.first().projection();
var glo30Image =
glo30collection.select('DEM').mosaic().setDefaultProjection(glo30Proj);
// Calculate aspect.
var glo30Aspect = ee.Terrain.aspect(glo30Image);
// Display layers.
Map.addLayer(glo30Image, elevationVis, 'GLO30 Elevation', false);
Map.addLayer(glo30Aspect, aspectVis, 'GLO30 Aspect');
Thiết lập Python
Hãy xem trang
Môi trường Python để biết thông tin về Python API và cách sử dụng geemap cho quá trình phát triển có tính tương tác.
import ee
import geemap.core as geemap
Colab (Python)
# Demonstrate ee.Terrain functions with single-image and collection DEMs.
# DEMs in Earth Engine are often distributed as single images per asset
# (e.g., NASA/NASADEM_HGT/001) or as collections of tiled images that need
# to be mosaicked (e.g., COPERNICUS/DEM/GLO30). Terrain analysis functions
# compute values based on neighboring pixels, so care must be taken to
# select and prepare DEM inputs appropriately.
# 1. Single DEM image asset.
# Assets like NASADEM are presented as single images covering large areas.
# They generally have a single projection and can be used in terrain analysis
# with no preprocessing.
nasadem = ee.Image('NASA/NASADEM_HGT/001').select('elevation')
# Calculate aspect: degrees, 0=N, 90=E, 180=S, 270=W.
nasadem_aspect = ee.Terrain.aspect(nasadem)
# Visualization parameters.
elevation_vis = {
'min': 0.0,
'max': 3000.0,
'palette': [
'333399',
'00a2e5',
'55dd77',
'ffff99',
'aa926b',
'aa928d',
'ffffff',
],
}
aspect_vis = {'min': 0.0, 'max': 359.99}
# Display layers.
m = geemap.Map()
m.set_center(-121.603, 47.702, 9)
m.add_layer(nasadem, elevation_vis, 'NASADEM Elevation', False)
m.add_layer(nasadem_aspect, aspect_vis, 'NASADEM Aspect')
# 2. Mosaicked DEM ImageCollection asset.
# In contrast to single-image assets like NASADEM, some DEMs like GLO30 are
# provided as a collection of images that need to be mosaicked before use.
# We use this mosaicked DEM for the terrain calculations below.
glo30_collection = ee.ImageCollection('COPERNICUS/DEM/GLO30')
# When mosaicking a DEM collection that will be used for terrain analysis,
# it is best practice to set the mosaic's default projection to the native
# projection of the DEM tiles. If you don't, Earth Engine's default
# projection for mosaics (EPSG:4326 at 1-degree scale) is used, which is
# often too coarse for analysis and can lead to resampling artifacts if
# the result is reprojected to a different CRS during computation.
# See:
# https://developers.google.com/earth-engine/guides/projections#reprojecting
glo30_proj = glo30_collection.first().projection()
glo30_image = (
glo30_collection.select('DEM').mosaic().setDefaultProjection(glo30_proj)
)
# Calculate aspect.
glo30_aspect = ee.Terrain.aspect(glo30_image)
# Display layers.
m.add_layer(glo30_image, elevation_vis, 'GLO30 Elevation', False)
m.add_layer(glo30_aspect, aspect_vis, 'GLO30 Aspect')
m
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2026-04-29 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2026-04-29 UTC."],[],[]]