Google earth engine(GEE)绘制沿山脉断面的海拔和温度(双轴坐标显示)

简介: Google earth engine(GEE)绘制沿山脉断面的海拔和温度(双轴坐标显示)


这次的案例是通过绘制一条直线,确定沿着这条直线的海拔和随着海拔的温度变化情况,用到的Landsat8数据和DEM数据。时间线主要是2013-2014年的夏天和冬天


温度采用的是L8的第十波段减去273.5得到的设置的时间是根据系统默认时间,获取影像的时间。

 


distance(right, maxError, proj)

Returns the minimum distance between the geometries of two features.

返回两个要素的几何之间的最小距离。


Arguments:

this:left (Element):

The feature containing the geometry used as the left operand of the operation.

right (Element):

The feature containing the geometry used as the right operand of the operation.

maxError (ErrorMargin, default: null):

The maximum amount of error tolerated when performing any necessary reprojection.

执行任何必要的重新投影时允许的最大错误量。

proj (Projection, default: null):

The projection in which to perform the operation. If not specified, the operation will be performed in a spherical coordinate system, and linear distances will be in meters on the sphere.


Returns: Float

//输入你的起点和重点的坐标,并且连接成线
var reno = [-119.821944, 39.527222];
var sf = [-122.416667, 37.783333];
var transect = ee.Geometry.LineString([reno, sf]);
// 选择影像按照你的线进行边界筛选,并且选出温度波段
var landsat8Toa = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA');
var temperature = landsat8Toa.filterBounds(transect)
    .select(['B10'], ['temp'])
    .map(function(image) {
      // 温度值转化为摄氏度
      return image.subtract(273.15)
          .set('system:time_start', image.get('system:time_start'));
    });
// 波段平均值计算和日期筛选; 并且合成单一波段影像
var summer = temperature.filterDate('2014-06-21', '2014-09-23')
    .reduce(ee.Reducer.mean())
    .select([0], ['summer']);在0这个位置放入
var winter = temperature.filterDate('2013-12-21', '2014-03-20')
    .reduce(ee.Reducer.mean())
    .select([0], ['winter']);
//选择DEM影像
var elevation = ee.Image('USGS/NED');  
//将点放入矢量集合当中
var startingPoint = ee.FeatureCollection(ee.Geometry.Point(sf));
//容许的间隔误差
var distance = startingPoint.distance(500000);
//将三个值分别加入一个影像形成3个波段
var image = distance.addBands(elevation).addBands(winter).addBands(summer);
// 沿着抛面线提前三个值并且转化为数组提前将数据,采样的间隔是1000
var array = image.reduceRegion(ee.Reducer.toList(), transect, 1000)
                 .toArray(image.bandNames());
//沿横断面按点与起点的距离对点进行排序。
//先切片再排序这是X轴的
var distances = array.slice(0, 0, 1);
array = array.sort(distances);
//先切片再排序这是Y轴的
var elevationAndTemp = array.slice(0, 1);  // For the Y axis.
// 投影距离切片以创建 x 轴值的一维数组。
var distance = array.slice(0, 0, 1).project([1]);
// 画图ui.Chart.array.values(X轴数组,生成一维向量系列所沿的轴,沿图表 x 轴的刻度标签)
var chart = ui.Chart.array.values(elevationAndTemp, 1, distance)
    .setChartType('LineChart')
    .setSeriesNames(['Elevation', 'Winter 2014', 'Summer 2014'])
    .setOptions({
      title: 'Elevation and temperatures along SF-to-Reno transect',
      vAxes: {//分别色湖之Y轴的标题和颜色
        0: {
          title: 'Average seasonal temperature (Celsius)'
        },
        1: {
          title: 'Elevation (meters)',
          baselineColor: 'transparent'
        }
      },
      hAxis: {//设置横轴的标题
        title: 'Distance from SF (m)'
      },
      interpolateNulls: true,
      pointSize: 0,
      lineWidth: 1,
      // Our chart has two Y axes: one for temperature and one for elevation.
      // The Visualization API allows us to assign each series to a specific
      // Y axis, which we do here:
      series: {//谢列的三个位置,一个横轴两个数周
        0: {targetAxisIndex: 1},
        1: {targetAxisIndex: 0},
        2: {targetAxisIndex: 0}
      }
    });
print(chart);
Map.setCenter(-121, 38.5, 7);
Map.addLayer(elevation, {min: 4000, max: 0});
Map.addLayer(transect, {color: 'FF0000'});


相关文章
|
3月前
|
数据可视化 定位技术 Sentinel
如何用Google Earth Engine快速、大量下载遥感影像数据?
【2月更文挑战第9天】本文介绍在谷歌地球引擎(Google Earth Engine,GEE)中,批量下载指定时间范围、空间范围的遥感影像数据(包括Landsat、Sentinel等)的方法~
537 0
如何用Google Earth Engine快速、大量下载遥感影像数据?
|
3月前
|
机器学习/深度学习 算法 数据可视化
基于Google Earth Engine云平台构建的多源遥感数据森林地上生物量AGB估算模型含生物量模型应用APP
基于Google Earth Engine云平台构建的多源遥感数据森林地上生物量AGB估算模型含生物量模型应用APP
106 0
|
3月前
GEE——Google dynamic world中在影像导出过程中无法完全导出较大面积影像的解决方案(投影的转换)EPSG:32630和EPSG:4326的区别
GEE——Google dynamic world中在影像导出过程中无法完全导出较大面积影像的解决方案(投影的转换)EPSG:32630和EPSG:4326的区别
41 0
|
2月前
|
存储 编解码 数据可视化
Google Earth Engine获取随机抽样点并均匀分布在栅格的不同数值区中
【2月更文挑战第14天】本文介绍在谷歌地球引擎(Google Earth Engine,GEE)中,按照给定的地表分类数据,对每一种不同的地物类型,分别加以全球范围内随机抽样点自动批量选取的方法~
260 0
Google Earth Engine获取随机抽样点并均匀分布在栅格的不同数值区中
|
3月前
|
API Go 网络架构
GEE Colab——如何从本地/Google云盘/Google Cloud Storage (GCS)上传和下载
GEE Colab——如何从本地/Google云盘/Google Cloud Storage (GCS)上传和下载
90 4
|
3月前
|
机器学习/深度学习 存储 人工智能
GEE Colab——初学者福音快速入门 Google Colab(Colaboratory)
GEE Colab——初学者福音快速入门 Google Colab(Colaboratory)
72 3
|
3月前
|
编解码 人工智能 算法
Google Earth Engine——促进森林温室气体报告的全球时间序列数据集
Google Earth Engine——促进森林温室气体报告的全球时间序列数据集
26 0
|
3月前
|
编解码 人工智能 数据库
Google Earth Engine(GEE)——全球道路盘查项目全球道路数据库
Google Earth Engine(GEE)——全球道路盘查项目全球道路数据库
45 0
|
3月前
|
编解码
Open Google Earth Engine(OEEL)——matrixUnit(...)中产生常量影像
Open Google Earth Engine(OEEL)——matrixUnit(...)中产生常量影像
21 0
|
3月前
Google Earth Engine(GEE)——导出指定区域的河流和流域范围
Google Earth Engine(GEE)——导出指定区域的河流和流域范围
44 0

热门文章

最新文章