NJU1healer的个人博客分享 http://blog.sciencenet.cn/u/NJU1healer

博文

GEE -- 研究区高程分布直方图绘制

已有 4625 次阅读 2020-7-9 21:23 |个人分类:Google earth engine|系统分类:科研笔记

对某个区域的DEM高程数据进行分析的时候,可以在GEE直接进行高程直方图分布绘图可视化

// Plot a histogram of elevation in XXX.


var elevation = ee.Image('CGIAR/SRTM90_V4');//高程数据选取

//var colorado = ee.Geometry.Rectangle(-109.05, 37, -102.05, 41);

//将矢量数据上传后筛选出某一城市 

var city = ee.FeatureCollection("users/ciscodengyw/Chinacity");

var hengyang = city.filter(ee.Filter.eq("市", "衡阳市"));


// Generate the histogram data.  Use minBucketWidth for nice sized buckets.

var histogram = ui.Chart.image.histogram({

  image: elevation,

  region: hengyang ,

  scale: 200,

  minBucketWidth: 300

});

histogram.setOptions({

  title: 'Histogram of Elevation in Hengyang (meters)'

});


print(histogram);


Map.addLayer(elevation.clip(hengyang));

Map.centerObject(hengyang,8)

结果:

点击右上角分享按钮得到:

可以下载图片与csv文件

关于直方图函数:

ui.Chart.image.histogram(image, region, scale, maxBuckets, minBucketWidth, maxRaw)

作用:从一张影像计算并生成直方图显示
- X-axis: Histogram buckets (of band value).
- Y-axis: Frequency (number of pixels with a band value in the bucket).
Returns a chart.

Arguments:

image (Image):

The image to generate a histogram from.

region (Feature|FeatureCollection|Geometry, optional):

缩减的区域. 默认为整幅影像

scale (Number, optional):

进行直方图缩减时使用的像元尺寸,意思是将原始像元进行一个再采样,单位为米

The pixel scale used when applying the histogram reducer, in meters.

maxBuckets (Number, optional):

The maximum number of buckets to use when building a histogram; will be rounded up to a power of 2.

minBucketWidth (Number, optional):

The minimum histogram bucket width, or null to allow any power of 2.

maxRaw (Number, optional):

The number of values to accumulate before building the initial histogram.

Returns: ui.Chart

【参考】

https://zhuanlan.zhihu.com/p/129393082




https://blog.sciencenet.cn/blog-3428464-1241344.html

上一篇:GEE -- 栅格影像批量NDVI,SAVI等指数
下一篇:GEE -- 混合像元分解
收藏 IP: 45.146.122.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

全部作者的其他最新博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-19 19:34

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部