הודעה: כל הפרויקטים הלא מסחריים שנרשמו לשימוש ב-Earth Engine לפני
15 באפריל 2025 חייבים
לאמת את הזכאות לשימוש לא מסחרי כדי לשמור על הגישה. אם לא תאמתו את החשבון עד 26 בספטמבר 2025, יכול להיות שהגישה שלכם תושעה.
ee.Geometry
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
יוצרת גיאומטריה.
שימוש | החזרות |
---|
ee.Geometry(geoJson, proj, geodesic, evenOdd) | גיאומטריה |
ארגומנט | סוג | פרטים |
---|
geoJson | אובייקט | אובייקט GeoJSON שמתאר את הגיאומטריה או אובייקט ComputedObject שצריך לפרש מחדש כאובייקט Geometry. תומך במפרטי CRS בהתאם למפרט GeoJSON, אבל מאפשר רק CRS עם שם (ולא CRS מקושר). אם השדה הזה כולל שדה geodesic, ולא מצוין opt_geodesic, המערכת תשתמש בו כ-opt_geodesic. |
proj | תחזית, אופציונלי | מפרט הקרנה אופציונלי, כמזהה CRS או כמחרוזת WKT. אם מציינים ערך, הוא מחליף כל CRS שנמצא בפרמטר geoJson. אם לא מציינים את מערכת הייחוס הגיאוגרפי (CRS) בקובץ ה-GeoJSON, ברירת המחדל היא EPSG:4326 (x=קו אורך, y=קו רוחב). |
geodesic | בוליאני, אופציונלי | הארגומנט שקובע אם לפרש קטעי קו כגיאודזיות כדוריות. אם הערך הוא false, המשמעות היא שצריך לפרש את קטעי הקו כקווים מישוריים במערכת קואורדינטות שצוינה. אם המאפיין לא מצוין, ברירת המחדל היא true אם ה-CRS הוא גיאוגרפי (כולל ברירת המחדל EPSG:4326), או false אם ה-CRS הוא מוקרן. |
evenOdd | בוליאני, אופציונלי | אם הערך הוא True, פנים הפוליגון ייקבע לפי כלל הזוגי/האי-זוגי, שבו נקודה נמצאת בפנים אם היא חוצה מספר אי-זוגי של קצוות כדי להגיע לנקודה באינסוף. אחרת, במצולעים נעשה שימוש בכלל 'הצד השמאלי', שבו החלק הפנימי נמצא בצד שמאל של קצוות המעטפת כשמסתכלים על הקודקודים בסדר הנתון. אם לא מציינים ערך, ברירת המחדל היא true. |
דוגמאות
עורך הקוד (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 Environment.
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())
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-26 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-26 (שעון UTC)."],[],[]]