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. Se non hai eseguito la verifica entro il 26 settembre 2025, il tuo accesso potrebbe essere sospeso.
ee.Geometry
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Crea una geometria.
Utilizzo | Resi |
---|
ee.Geometry(geoJson, proj, geodesic, evenOdd) | Geometria |
Argomento | Tipo | Dettagli |
---|
geoJson | Oggetto | L'oggetto GeoJSON che descrive la geometria o un ComputedObject da reinterpretare come geometria. Supporta le specifiche CRS in base alla specifica GeoJSON, ma consente solo CRS denominati
(anziché CRS "collegati"). Se include un campo "geodetico" e opt_geodesic non è specificato, verrà utilizzato come opt_geodesic. |
proj | Proiezione, facoltativa | Una specifica di proiezione facoltativa, come codice ID CRS o come stringa WKT. Se specificato, esegue l'override di qualsiasi CRS trovato nel parametro geoJson. Se non specificato e il file GeoJSON non dichiara un CRS, il valore predefinito è "EPSG:4326" (x=longitudine, y=latitudine). |
geodesic | Booleano, facoltativo | Indica se i segmenti di linea devono essere interpretati come geodetiche sferiche. Se è false, indica che i segmenti di linea devono essere interpretati come linee planari nel sistema di riferimento specificato. Se assente, il valore predefinito è true se il CRS è geografico (incluso EPSG:4326 predefinito) o false se il CRS è proiettato. |
evenOdd | Booleano, facoltativo | Se true, gli interni del poligono saranno determinati dalla regola pari/dispari, in base alla quale un punto si trova all'interno se attraversa un numero dispari di bordi per raggiungere un punto all'infinito. In caso contrario, i poligoni utilizzano la regola sinistra-interna, in cui gli interni si trovano sul lato sinistro dei bordi della shell quando si percorrono i vertici nell'ordine specificato. Se non specificato, il valore predefinito è true. |
Esempi
Editor di codice (JavaScript)
// A GeoJSON object for a triangular polygon.
var geojsonObject = {
"type": "Polygon",
"coordinates": [
[
[
-122.085,
37.423
],
[
-122.092,
37.424
],
[
-122.085,
37.418
],
[
-122.085,
37.423
]
]
]
};
print('ee.Geometry accepts a GeoJSON object', ee.Geometry(geojsonObject));
// GeoJSON strings need to be converted to an object.
var geojsonString = JSON.stringify(geojsonObject);
print('A GeoJSON string needs to be converted to an object',
ee.Geometry(JSON.parse(geojsonString)));
// Use ee.Geometry to cast computed geometry objects into the ee.Geometry
// class to access their methods. In the following example an ee.Geometry
// object is stored as a ee.Feature property. When it is retrieved with the
// .get() function, a computed geometry object is returned. Cast the computed
// object as a ee.Geometry to get the geometry's bounds, for instance.
var feature = ee.Feature(null, {geom: ee.Geometry(geojsonObject)});
print('Cast computed geometry objects to ee.Geometry class',
ee.Geometry(feature.get('geom')).bounds());
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)
import json
# A GeoJSON object for a triangular polygon.
geojson_object = {
'type': 'Polygon',
'coordinates': [
[
[
-122.085,
37.423
],
[
-122.092,
37.424
],
[
-122.085,
37.418
],
[
-122.085,
37.423
]
]
]
}
print(
'ee.Geometry accepts a GeoJSON object:',
ee.Geometry(geojson_object).getInfo()
)
# GeoJSON strings need to be converted to an object.
geojson_string = json.dumps(geojson_object)
print('A GeoJSON string needs to be converted to an object:',
ee.Geometry(json.loads(geojson_string)).getInfo())
# Use ee.Geometry to cast computed geometry objects into the ee.Geometry
# class to access their methods. In the following example an ee.Geometry
# object is stored as a ee.Feature property. When it is retrieved with the
# .get() function, a computed geometry object is returned. Cast the computed
# object as a ee.Geometry to get the geometry's bounds, for instance.
feature = ee.Feature(None, {'geom': ee.Geometry(geojson_object)})
print('Cast computed geometry objects to ee.Geometry class:',
ee.Geometry(feature.get('geom')).bounds().getInfo())
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."],[],[]]