ee.Geometry

Geometri oluşturur.

Kullanımİadeler
ee.Geometry(geoJson, proj, geodesic, evenOdd)Geometri
Bağımsız DeğişkenTürAyrıntılar
geoJsonNesneGeometriyi açıklayan GeoJSON nesnesi veya Geometri olarak yeniden yorumlanacak bir ComputedObject. GeoJSON spesifikasyonuna göre CRS spesifikasyonlarını destekler ancak yalnızca adlandırılmış CRS'lere izin verir ("bağlantılı" CRS'lere izin verilmez). Bu alan bir "jeodezik" alanı içeriyorsa ve opt_geodesic belirtilmemişse opt_geodesic olarak kullanılır.
projProjeksiyon, isteğe bağlıİsteğe bağlı bir projeksiyon spesifikasyonu, CRS kimlik kodu veya WKT dizesi olarak. Belirtilirse geoJson parametresinde bulunan tüm CRS'leri geçersiz kılar. Belirtilmemişse ve geoJson bir CRS beyan etmiyorsa varsayılan olarak "EPSG:4326" (x=boylam, y=enlem) olur.
geodesicBoole değeri, isteğe bağlıÇizgi segmentlerinin küresel jeodezikler olarak yorumlanıp yorumlanmayacağı. Yanlışsa çizgi segmentlerinin, belirtilen CRS'de düzlemsel çizgiler olarak yorumlanması gerektiğini gösterir. Yoksa CRS coğrafi ise (varsayılan EPSG:4326 dahil) varsayılan olarak doğru, CRS projeksiyonlu ise yanlış olur.
evenOddBoole değeri, isteğe bağlıDoğruysa poligon iç kısımları, çift/tek kuralıyla belirlenir. Bu kuralda, sonsuzluktaki bir noktaya ulaşmak için tek sayıda kenarı geçen bir nokta içeride kabul edilir. Aksi takdirde, çokgenler sol-iç kuralını kullanır. Bu kuralda, köşeler belirli bir sırada yüründüğünde iç kısımlar kabuğun kenarlarının sol tarafında yer alır. Belirtilmemişse varsayılan olarak true (doğru) olur.

Örnekler

Kod Düzenleyici (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());

Python kurulumu

Python API'si ve etkileşimli geliştirme için geemap kullanımı hakkında bilgi edinmek üzere Python Ortamı sayfasına bakın.

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())