ee.Geometry

ज्यामिति बनाता है.

इस्तेमालरिटर्न
ee.Geometry(geoJson, proj, geodesic, evenOdd)ज्यामिति
आर्ग्यूमेंटटाइपविवरण
geoJsonऑब्जेक्टज्यामिति के बारे में बताने वाला GeoJSON ऑब्जेक्ट या ComputedObject, जिसे Geometry के तौर पर फिर से समझा जाना है. यह GeoJSON स्पेसिफ़िकेशन के मुताबिक, सीआरएस स्पेसिफ़िकेशन के साथ काम करता है. हालांकि, इसमें सिर्फ़ नाम वाले सीआरएस इस्तेमाल किए जा सकते हैं, "लिंक किए गए" सीआरएस नहीं. अगर इसमें 'geodesic' फ़ील्ड शामिल है और opt_geodesic की वैल्यू नहीं दी गई है, तो इसे opt_geodesic के तौर पर इस्तेमाल किया जाएगा.
projअनुमान, ज़रूरी नहीं हैप्रोजेक्शन की जानकारी देने वाला एक वैकल्पिक स्पेसिफ़िकेशन. इसे सीआरएस आईडी कोड या डब्ल्यूकेटी स्ट्रिंग के तौर पर दिया जा सकता है. अगर यह पैरामीटर दिया गया है, तो यह geoJson पैरामीटर में मौजूद किसी भी सीआरएस को बदल देता है. अगर इसकी जानकारी नहीं दी गई है और geoJson में सीआरएस के बारे में नहीं बताया गया है, तो डिफ़ॉल्ट रूप से "EPSG:4326" (x=देशांतर, y=अक्षांश) का इस्तेमाल किया जाता है.
geodesicबूलियन, ज़रूरी नहींलाइन सेगमेंट को स्फ़ेरिकल जियोडेसिक के तौर पर माना जाना चाहिए या नहीं. अगर यह विकल्प 'गलत' पर सेट है, तो इसका मतलब है कि लाइन सेगमेंट को दिए गए सीआरएस में प्लैनर लाइनों के तौर पर समझा जाना चाहिए. अगर यह मौजूद नहीं है, तो अगर सीआरएस भौगोलिक है (इसमें डिफ़ॉल्ट EPSG:4326 शामिल है), तो इसकी डिफ़ॉल्ट वैल्यू true होती है. अगर सीआरएस प्रोजेक्टेड है, तो इसकी डिफ़ॉल्ट वैल्यू false होती है.
evenOddबूलियन, ज़रूरी नहींअगर यह विकल्प चुना जाता है, तो पॉलीगॉन के अंदरूनी हिस्से का फ़ैसला सम/विषम नियम के हिसाब से किया जाएगा. इस नियम के तहत, अगर कोई पॉइंट इनफ़िनिटी पर मौजूद किसी पॉइंट तक पहुंचने के लिए विषम संख्या में किनारों को पार करता है, तो उसे पॉलीगॉन के अंदर माना जाता है. इसके अलावा, पॉलीगॉन में लेफ्ट-इनसाइड नियम का इस्तेमाल किया जाता है. इसमें, दिए गए क्रम में वर्टेक्स पर चलने के दौरान, इंटीरियर शेल के किनारों के बाईं ओर होते हैं. अगर कोई वैल्यू नहीं दी गई है, तो डिफ़ॉल्ट रूप से इसकी वैल्यू 'सही है' होती है.

उदाहरण

कोड एडिटर (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 सेटअप करना

Python API और इंटरैक्टिव डेवलपमेंट के लिए geemap का इस्तेमाल करने के बारे में जानकारी पाने के लिए, Python एनवायरमेंट पेज देखें.

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