ee.Geometry.Rectangle.distance
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
מחזירה את המרחק המינימלי בין שתי צורות גיאומטריות.
שימוש | החזרות |
---|
Rectangle.distance(right, maxError, proj, spherical) | מספר ממשי (float) |
ארגומנט | סוג | פרטים |
---|
זה: left | גיאומטריה | הגיאומטריה ששימשה כאופרטנד הימני של הפעולה. |
right | גיאומטריה | הגיאומטריה שמשמש כאופרטנד הימני של הפעולה. |
maxError | ErrorMargin, ברירת המחדל: null | רמת השגיאה המקסימלית שאפשר לסבול במהלך הקרנה מחדש (reprojection) נדרשת. |
proj | הקרנה, ברירת מחדל: null | התצוגה (projection) שבה מבצעים את הפעולה. אם לא יצוין, הפעולה תתבצע במערכת קואורדינטות כדורית, והמרחקים הלינאריים יהיו במטרים על פני הכדור. |
spherical | בוליאני, ברירת המחדל: false | אם הערך הוא true, החישוב יתבצע על פני כדור יחידה. אם הערך הוא false, החישוב יהיה אליפטי, תוך התחשבות בקימור כדור הארץ. המערכת תתעלם מהמאפיין אם צוין proj. ברירת המחדל היא FALSE. |
דוגמאות
Code Editor (JavaScript)
// Define a Rectangle object.
var rectangle = ee.Geometry.Rectangle(-122.09, 37.42, -122.08, 37.43);
// Define other inputs.
var inputGeom = ee.Geometry.Point(-122.090, 37.423);
// Apply the distance method to the Rectangle object.
var rectangleDistance = rectangle.distance({'right': inputGeom, 'maxError': 1});
// Print the result to the console.
print('rectangle.distance(...) =', rectangleDistance);
// Display relevant geometries on the map.
Map.setCenter(-122.085, 37.422, 15);
Map.addLayer(rectangle,
{'color': 'black'},
'Geometry [black]: rectangle');
Map.addLayer(inputGeom,
{'color': 'blue'},
'Parameter [blue]: inputGeom');
הגדרת Python
בדף
סביבת Python מפורט מידע על Python API ועל השימוש ב-geemap
לפיתוח אינטראקטיבי.
import ee
import geemap.core as geemap
Colab (Python)
# Define a Rectangle object.
rectangle = ee.Geometry.Rectangle(-122.09, 37.42, -122.08, 37.43)
# Define other inputs.
input_geom = ee.Geometry.Point(-122.090, 37.423)
# Apply the distance method to the Rectangle object.
rectangle_distance = rectangle.distance(right=input_geom, maxError=1)
# Print the result.
display('rectangle.distance(...) =', rectangle_distance)
# Display relevant geometries on the map.
m = geemap.Map()
m.set_center(-122.085, 37.422, 15)
m.add_layer(rectangle, {'color': 'black'}, 'Geometry [black]: rectangle')
m.add_layer(input_geom, {'color': 'blue'}, 'Parameter [blue]: input_geom')
m
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-25 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-25 (שעון UTC)."],[],[],null,[]]