Annuncio: tutti i progetti non commerciali registrati per l'utilizzo di Earth Engine prima del
15 aprile 2025 devono
verificare l'idoneità non commerciale per mantenere l'accesso a Earth Engine.
ee.Image.changeProj
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Modifica la proiezione dell'immagine di input, spostando ogni pixel dalla sua posizione in srcProj alle stesse coordinate in dstProj.
Utilizzo | Resi |
---|
Image.changeProj(srcProj, dstProj) | Immagine |
Argomento | Tipo | Dettagli |
---|
questo: input | Immagine | |
srcProj | Projection | La proiezione originale. |
dstProj | Projection | La nuova proiezione. |
Esempi
Editor di codice (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');
Configurazione di Python
Consulta la pagina
Ambiente Python per informazioni sull'API Python e sull'utilizzo di
geemap
per lo sviluppo interattivo.
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
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-07-26 UTC.
[null,null,["Ultimo aggiornamento 2025-07-26 UTC."],[[["\u003cp\u003e\u003ccode\u003eImage.changeProj()\u003c/code\u003e modifies the projection of an image by moving pixels to match coordinates in a new projection.\u003c/p\u003e\n"],["\u003cp\u003eIt takes the original projection (\u003ccode\u003esrcProj\u003c/code\u003e) and the target projection (\u003ccode\u003edstProj\u003c/code\u003e) as inputs.\u003c/p\u003e\n"],["\u003cp\u003eYou can define projections using WKT strings or EPSG codes.\u003c/p\u003e\n"],["\u003cp\u003eThe function returns a new Image object with the altered projection.\u003c/p\u003e\n"],["\u003cp\u003eThis is useful for visualizing or processing data in different coordinate systems.\u003c/p\u003e\n"]]],["The `changeProj` function modifies an image's projection by relocating each pixel from its original projection (`srcProj`) to a new projection (`dstProj`). This is done by taking an image object as input and takes in two parameters `srcProj` and `dstProj`. For example, it takes a DEM image, defines a Robinson projection with an adjusted scale, and then applies `changeProj` to re-project the image onto the map canvas projection (`EPSG:3857`). The result is an image with the modified projection.\n"],null,["# ee.Image.changeProj\n\nTweaks the projection of the input image, moving each pixel from its location in srcProj to the same coordinates in dstProj.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|--------------------------------------|---------|\n| Image.changeProj`(srcProj, dstProj)` | Image |\n\n| Argument | Type | Details |\n|---------------|------------|--------------------------|\n| this: `input` | Image | |\n| `srcProj` | Projection | The original projection. |\n| `dstProj` | Projection | The new projection. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// A DEM image object.\nvar img = ee.Image('MERIT/DEM/v1_0_3');\n\n// Construct a projection object from a WKT string or EPSG code, for example,\n// the Robinson projection (https://epsg.io/54030).\nvar proj = ee.Projection(\n 'PROJCS[\"World_Robinson\",' +\n 'GEOGCS[\"GCS_WGS_1984\",' +\n 'DATUM[\"WGS_1984\",' +\n 'SPHEROID[\"WGS_1984\",6378137,298.257223563]],' +\n 'PRIMEM[\"Greenwich\",0],' +\n 'UNIT[\"Degree\",0.017453292519943295]],' +\n 'PROJECTION[\"Robinson\"],' +\n 'UNIT[\"Meter\",1]]'\n)\n// Optionally adjust projection scale; stretch layer larger in this case.\n.scale(0.9, 0.9);\n\n// \"Paint\" the image in the desired projection onto the projection of\n// the map canvas ('EPSG:3857').\nvar imgProj = img.changeProj(proj, 'EPSG:3857');\n\n// Add an overlay image to the map to cover the default base layers.\nMap.setCenter(0, 0, 2);\nMap.addLayer(ee.Image(1), {palette: 'grey'}, 'Grey background', false);\n\n// Add the projection-tweaked image to the map.\nMap.addLayer(imgProj, {min: 0, max: 3000}, 'DEM in Robinson projection');\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\n# A DEM image object.\nimg = ee.Image('MERIT/DEM/v1_0_3')\n\n# Construct a projection object from a WKT string or EPSG code, for example,\n# the Robinson projection (https://epsg.io/54030).\nproj = (\n ee.Projection(\n 'PROJCS[\"World_Robinson\",'\n + 'GEOGCS[\"GCS_WGS_1984\",'\n + 'DATUM[\"WGS_1984\",'\n + 'SPHEROID[\"WGS_1984\",6378137,298.257223563]],'\n + 'PRIMEM[\"Greenwich\",0],'\n + 'UNIT[\"Degree\",0.017453292519943295]],'\n + 'PROJECTION[\"Robinson\"],'\n + 'UNIT[\"Meter\",1]]'\n )\n # Optionally adjust projection scale stretch layer larger in this case.\n .scale(0.9, 0.9)\n)\n\n# \"Paint\" the image in the desired projection onto the projection of\n# the map canvas ('EPSG:3857').\nimg_proj = img.changeProj(proj, 'EPSG:3857')\n\n# Add an overlay image to the map to cover the default base layers.\nm = geemap.Map()\nm.set_center(0, 0, 2)\nm.add_layer(ee.Image(1), {'palette': 'grey'}, 'Grey background', False)\n\n# Add the projection-tweaked image to the map.\nm.add_layer(\n img_proj,\n {'min': 0, 'max': 3000},\n 'DEM in Robinson projection',\n)\nm\n```"]]