当前位置:网站首页>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');
边栏推荐
- Today, I met a Alipay and took out 35K. It's really sandpaper to wipe my ass. it's a show for me
- MySQL learning notes (Advanced)
- treevalue——Master Nested Data Like Tensor
- Chargement de l'image pyqt après décodage et codage de l'image
- qwb2018_ core kernel_ rop
- How to test the process of restoring backup files?
- Blue Bridge Cup Eliminate last one (bit operation, code completion)
- Market trend report, technical innovation and market forecast of China's Micro pliers
- MySQL learning record (2)
- Internet Explorer ignores cookies on some domains (cannot read or set cookies)
猜你喜欢
![[Yu Yue education] reference materials of analog electronic technology of Nanjing Institute of information technology](/img/2f/bb99836bb3ad725483f30531ff4d53.jpg)
[Yu Yue education] reference materials of analog electronic technology of Nanjing Institute of information technology

MySQL learning record (5)

Huawei Hongmeng watch achieves fireworks display effect on New Year's Eve

qwb2018_ core kernel_ rop

Unexpectedly, there are such sand sculpture code comments! I laughed

Three chess games

GEE:(二)对影像进行重采样

Basic IO interface technology - microcomputer Chapter 7 Notes

The neo4j skill tree was officially released to help you easily master the neo4j map database

Read a doctor, the kind that studies cows! Dr. enrollment of livestock technology group of Leuven University, milk quality monitoring
随机推荐
Construction and maintenance of business website [3]
Construction and maintenance of business websites [9]
MySQL learning record (2)
MySQL learning record (9)
How is LinkedList added?
It is said that this year gold three silver four has become gold one silver two..
Huawei Hongmeng watch achieves fireworks display effect on New Year's Eve
How to test the process of restoring backup files?
treevalue——Master Nested Data Like Tensor
[CV] Wu Enda machine learning course notes | Chapter 12
China's noise meter market trend report, technical dynamic innovation and market forecast
D4: unpaired image defogging, self enhancement method based on density and depth decomposition (CVPR 2022)
Research Report on market supply and demand and strategy of China's plastic trunking industry
Browser - clean up the cache of JS in the page
2019 Nanchang (relive the classic)
Research Report on micro vacuum pump industry - market status analysis and development prospect prediction
[shutter] statefulwidget component (pageview component)
VictoriaMetrics 简介
One week dynamics of dragon lizard community | 2.07-2.13
Construction and maintenance of business websites [6]