当前位置:网站首页>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');
边栏推荐
- PIP audit: a powerful security vulnerability scanning tool
- [shutter] shutter gesture interaction (click event handling | click OnTap | double click | long press | click Cancel | press ontapdown | lift ontapup)
- Research Report on market supply and demand and strategy of China's right-hand outward rotation entry door industry
- Analysis of enterprise financial statements [1]
- AES encryption CBC mode pkcs7padding filling Base64 encoding key 32byte iv16byte
- Detailed explanation of OSI seven layer model
- Centos7 installation and configuration of redis database
- [Yu Yue education] reference materials of analog electronic technology of Nanjing Institute of information technology
- 【剑指 Offer】57. 和为s的两个数字
- Share the easy-to-use fastadmin open source system - Installation
猜你喜欢
GEE:(二)对影像进行重采样
Technical solution of vision and manipulator calibration system
Basic IO interface technology - microcomputer Chapter 7 Notes
[shutter] shutter layout component (wrap component | expanded component)
Three chess games
[shutter] shutter layout component (opacity component | clipprect component | padding component)
Report on investment development and strategic recommendations of China's vibration isolator market, 2022-2027
*C language final course design * -- address book management system (complete project + source code + detailed notes)
pip安裝whl文件報錯:ERROR: ... is not a supported wheel on this platform
Investment strategy analysis of China's electronic information manufacturing industry and forecast report on the demand outlook of the 14th five year plan 2022-2028 Edition
随机推荐
PIP audit: a powerful security vulnerability scanning tool
[shutter] shutter layout component (wrap component | expanded component)
B.Odd Swap Sort(Codeforces Round #771 (Div. 2))
读博士吧,研究奶牛的那种!鲁汶大学 Livestock Technology 组博士招生,牛奶质量监测...
Import a large amount of data to redis in shell mode
[shutter] statefulwidget component (floatingactionbutton component | refreshindicator component)
【剑指 Offer】57. 和为s的两个数字
Research Report on plastic antioxidant industry - market status analysis and development prospect forecast
One week dynamics of dragon lizard community | 2.07-2.13
What is the difference between programming in real work and that in school?
kernel_ uaf
如何访问kubernetes API?
China plastic bottle and container market trend report, technological innovation and market forecast
VictoriaMetrics 简介
26 FPS video super-resolution model DAP! Output 720p Video Online
Internet Explorer ignores cookies on some domains (cannot read or set cookies)
MySQL inserts Chinese data and reports an error. Set the default collation
Physical layer cables and equipment
Basic knowledge of tree and binary tree (detailed illustration)
Investment strategy analysis of China's electronic information manufacturing industry and forecast report on the demand outlook of the 14th five year plan 2022-2028 Edition