当前位置:网站首页>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');
边栏推荐
- MySQL inserts Chinese data and reports an error. Set the default collation
- 26 FPS video super-resolution model DAP! Output 720p Video Online
- rwctf2022_ QLaaS
- Accounting regulations and professional ethics [18]
- Analysis of enterprise financial statements [4]
- Check the confession items of 6 yyds
- ~91 rotation
- MySQL installation failed -gpg verification failed
- Technical solution of vision and manipulator calibration system
- Go language learning summary (5) -- Summary of go learning notes
猜你喜欢

MySQL learning record (4)

Blue Bridge Cup Winter vacation homework (DFS backtracking + pruning)

MySQL learning record (3)
![The web version of xshell supports FTP connection and SFTP connection [detailed tutorial] continued from the previous article](/img/8f/6759b4685a129f9d10d6ea1dc8e61e.jpg)
The web version of xshell supports FTP connection and SFTP connection [detailed tutorial] continued from the previous article

How to prevent your jar from being decompiled?
![[zero foundation I] Navicat download link](/img/23/e7808884152eeaf186fe756d6adac6.png)
[zero foundation I] Navicat download link

Read a doctor, the kind that studies cows! Dr. enrollment of livestock technology group of Leuven University, milk quality monitoring

Check the confession items of 6 yyds

发现你看不到的物体!南开&武大&ETH提出用于伪装目标检测SINet,代码已开源!...
![[shutter] shutter page Jump (route | navigator | page close)](/img/af/3fb2ca18bcec23a5c0c6897570fb53.gif)
[shutter] shutter page Jump (route | navigator | page close)
随机推荐
Today, I met a Alipay and took out 35K. It's really sandpaper to wipe my ass. it's a show for me
Blue Bridge Cup Eliminate last one (bit operation, code completion)
Market trend report, technical innovation and market forecast of China's Micro pliers
Analysis of neural network
Plastic granule Industry Research Report - market status analysis and development prospect forecast
Structured text language XML
Research Report on market supply and demand and strategy of China's atomic spectrometer industry
Five message formats of OSPF
Physical layer cables and equipment
[CV] Wu Enda machine learning course notes | Chapter 12
kernel tty_ struct
MySQL learning record (3)
Market trend report, technical dynamic innovation and market forecast of China's low gloss instrument
[shutter] statefulwidget component (floatingactionbutton component | refreshindicator component)
[shutter] shutter layout component (wrap component | expanded component)
Welfare, let me introduce you to someone
A specially designed loss is used to deal with data sets with unbalanced categories
[shutter] shutter layout component (Introduction to layout component | row component | column component | sizedbox component | clipoval component)
【剑指 Offer】56 - I. 数组中数字出现的次数
It is said that this year gold three silver four has become gold one silver two..