Send feedback
ee.Image.changeProj
Stay organized with collections
Save and categorize content based on your preferences.
Tweaks the projection of the input image, moving each pixel from its location in srcProj to the same coordinates in dstProj.
Usage Returns Image. changeProj (srcProj, dstProj)
Image
Argument Type Details this: input
Image srcProj
Projection The original projection. dstProj
Projection The new projection.
Examples
Code Editor (JavaScript)
// A DEM image object.
var img = ee . Image ( 'MERIT/DEM/v1_0_3' );
// Construct a projection object from a WKT string or EPSG code, for example,
// the Robinson projection (https://epsg.io/54030).
var proj = ee . Projection (
'PROJCS["World_Robinson",' +
'GEOGCS["GCS_WGS_1984",' +
'DATUM["WGS_1984",' +
'SPHEROID["WGS_1984",6378137,298.257223563]],' +
'PRIMEM["Greenwich",0],' +
'UNIT["Degree",0.017453292519943295]],' +
'PROJECTION["Robinson"],' +
'UNIT["Meter",1]]'
)
// Optionally adjust projection scale; stretch layer larger in this case.
. scale ( 0.9 , 0.9 );
// "Paint" the image in the desired projection onto the projection of
// the map canvas ('EPSG:3857').
var imgProj = img . changeProj ( proj , 'EPSG:3857' );
// Add an overlay image to the map to cover the default base layers.
Map . setCenter ( 0 , 0 , 2 );
Map . addLayer ( ee . Image ( 1 ), { palette : 'grey' }, 'Grey background' , false );
// Add the projection-tweaked image to the map.
Map . addLayer ( imgProj , { min : 0 , max : 3000 }, 'DEM in Robinson projection' );
Python setup
See the
Python Environment page for information on the Python API and using
geemap
for interactive development.
import ee
import geemap.core as geemap
Colab (Python)
# A DEM image object.
img = ee . Image ( 'MERIT/DEM/v1_0_3' )
# Construct a projection object from a WKT string or EPSG code, for example,
# the Robinson projection (https://epsg.io/54030).
proj = (
ee . Projection (
'PROJCS["World_Robinson",'
+ 'GEOGCS["GCS_WGS_1984",'
+ 'DATUM["WGS_1984",'
+ 'SPHEROID["WGS_1984",6378137,298.257223563]],'
+ 'PRIMEM["Greenwich",0],'
+ 'UNIT["Degree",0.017453292519943295]],'
+ 'PROJECTION["Robinson"],'
+ 'UNIT["Meter",1]]'
)
# Optionally adjust projection scale stretch layer larger in this case.
. scale ( 0.9 , 0.9 )
)
# "Paint" the image in the desired projection onto the projection of
# the map canvas ('EPSG:3857').
img_proj = img . changeProj ( proj , 'EPSG:3857' )
# Add an overlay image to the map to cover the default base layers.
m = geemap . Map ()
m . set_center ( 0 , 0 , 2 )
m . add_layer ( ee . Image ( 1 ), { 'palette' : 'grey' }, 'Grey background' , False )
# Add the projection-tweaked image to the map.
m . add_layer (
img_proj ,
{ 'min' : 0 , 'max' : 3000 },
'DEM in Robinson projection' ,
)
m
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
Need to tell us more?
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-06 UTC."],[[["`Image.changeProj()` modifies the projection of an image by moving pixels to match coordinates in a new projection."],["It takes the original projection (`srcProj`) and the target projection (`dstProj`) as inputs."],["You can define projections using WKT strings or EPSG codes."],["The function returns a new Image object with the altered projection."],["This is useful for visualizing or processing data in different coordinate systems."]]],[]]