当前位置:网站首页>Gee: (II) resampling the image
Gee: (II) resampling the image
2022-07-02 21:43:00 【BetterQ.】
In the use of GEE When resampling an image , Mainly used .reproject(crs, crsTransform, scale)
function , The parameters and usage of this function are introduced below .img.reproject(crs, crsTransform, scale)
this:image (Image):
Images that need to be re projected
crs (Projection):
The coordinate system of re projection
crsTransform (List, default: null):
The list of CRS transform values. This is a row-major ordering of the 3x2 transform matrix. This option is mutually exclusive with the scale option, and replaces any transform already on the projection.
scale (Float, default: null):
The resolution can be set during re projection
There will be Sentinel-2 Image resampled to 100m As an example , stay GEE The implementation code is as follows :
// De cloud function
function maskS2clouds(image) {
var qa = image.select('QA60');
// Bits 10 and 11 are clouds and cirrus, respectively.
var cloudBitMask = 1 << 10;
var cirrusBitMask = 1 << 11;
// Both flags should be set to zero, indicating clear conditions.
var mask = qa.bitwiseAnd(cloudBitMask).eq(0).and(qa.bitwiseAnd(cirrusBitMask).eq(0));
return image.updateMask(mask).divide(10000);
}
// Import polygon area
var geometry =
ee.Geometry.Polygon(
[[[17.86466765871711, 51.805755132803185],
[17.86466765871711, 48.51354071088587],
[24.85197234621711, 48.51354071088587],
[24.85197234621711, 51.805755132803185]]], null, false);
// Import sentry 2 data
var image = ee.ImageCollection('COPERNICUS/S2_SR')
.filterDate('2017-02-01', '2017-11-30')
.filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE',20))
.map(maskS2clouds)
.median()
.clip(geometry);
// Output the coordinate system and resolution without re projection
print('Proj and transform info of image:', image.projection().getInfo())
print('Pixel size in meters:', image.projection().nominalScale().getInfo())
// Output the coordinate system and resolution after re projection , Here, set the resolution to 100m
var reprojected = image.reproject('EPSG:4326',null,100);
print('Proj and transform info after reprojection:', reprojected.projection());
print('Pixel size in meters:', reprojected.projection().nominalScale());
result :
The above method is actually a re projection of the original image data , The resolution is reset during re projection , A resampling method is also provided on the official website , It uses .resample()
function , The specific implementation code is as follows :
// load landsat image
var landsat = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_044034_20160323');
// Set display parameters
Map.setCenter(-122.37383, 37.6193, 15);
var visParams = {
bands: ['B4', 'B3', 'B2'], max: 0.3};
// Generally, the nearest pixel interpolation is used by default when loading images at the beginning
Map.addLayer(landsat, visParams, 'original image');
// Resample it with bicubic curve
var resampled = landsat.resample('bicubic');
// Show the resampled data
Map.addLayer(resampled, visParams, 'resampled');
If in reality , We have 10m and 500m The data of , Need a unified scale , You need to be right about 10m Down sample the image of , Can be combined with .reduceResolution
and .reproject
Realization :
// Load a MODIS EVI image.
var modis = ee.Image(ee.ImageCollection('MODIS/006/MOD13A1').first())
.select('EVI');
// Display the EVI image near La Honda, California.
Map.setCenter(-122.3616, 37.5331, 12);
Map.addLayer(modis, {
min: 2000, max: 5000}, 'MODIS EVI 500 m');
// Get information about the MODIS projection.
var modisProjection = modis.projection();
print('MODIS projection:', modisProjection);
// Load and display forest cover data at 30 meters resolution.
var forest = ee.Image('UMD/hansen/global_forest_change_2015')
.select('treecover2000');
Map.addLayer(forest, {
max: 80}, 'forest cover 30 m');
// Get the forest cover data at MODIS scale and projection.
var forestMean = forest
// Force the next reprojection to aggregate instead of resampling.
.reduceResolution({
reducer: ee.Reducer.mean(),
maxPixels: 1024
})
// Request the data at the scale and projection of the MODIS image.
.reproject({
crs: modisProjection
});
// Display the aggregated, reprojected forest cover data.
Map.addLayer(forestMean, {
max: 80}, 'forest cover at MODIS scale 500 m');
边栏推荐
- 如何防止你的 jar 被反编译?
- Construction and maintenance of business website [1]
- ~90z axis translation
- Internet Explorer ignores cookies on some domains (cannot read or set cookies)
- *C language final course design * -- address book management system (complete project + source code + detailed notes)
- 【零基础一】Navicat下载链接
- 【剑指 Offer 】56 - II. 数组中数字出现的次数 II
- 如何访问kubernetes API?
- Golang string segmentation
- Micro SD Card Industry Research Report - market status analysis and development prospect forecast
猜你喜欢
Blue Bridge Cup Winter vacation homework (DFS backtracking + pruning)
D4: unpaired image defogging, self enhancement method based on density and depth decomposition (CVPR 2022)
【零基础一】Navicat下载链接
One week dynamics of dragon lizard community | 2.07-2.13
Basic IO interface technology - microcomputer Chapter 7 Notes
[shutter] statefulwidget component (image component | textfield component)
MySQL learning notes (Advanced)
D4:非成对图像去雾,基于密度与深度分解的自增强方法(CVPR 2022)
基本IO接口技术——微机第七章笔记
Etcd Raft 协议
随机推荐
3DES (deSede) encryption CBC mode pkcs7padding filling Base64 encoding key 24byte iv8byte
B.Odd Swap Sort(Codeforces Round #771 (Div. 2))
Browser - clean up the cache of JS in the page
Construction and maintenance of business website [5]
26 FPS video super-resolution model DAP! Output 720p Video Online
Golang embeds variables in strings
PIP version update timeout - download using domestic image
Today, I met a Alipay and took out 35K. It's really sandpaper to wipe my ass. it's a show for me
Accounting regulations and professional ethics [19]
[shutter] shutter gesture interaction (click event handling | click OnTap | double click | long press | click Cancel | press ontapdown | lift ontapup)
How to prevent your jar from being decompiled?
Construction and maintenance of business websites [8]
基本IO接口技术——微机第七章笔记
MySQL installation failed -gpg verification failed
Unexpectedly, there are such sand sculpture code comments! I laughed
MySQL learning record (3)
Construction and maintenance of business websites [4]
One week dynamics of dragon lizard community | 2.07-2.13
Analysis of enterprise financial statements [4]
tinymce可视化编辑器增加百度地图插件