ee.Geometry.Point.centroid

מחזירה נקודה במרכז הרכיבים של הגיאומטריה עם המימד הגבוה ביותר. המערכת מתעלמת מרכיבים בממד נמוך יותר, ולכן מרכז הכובד של צורה גיאומטרית שמכילה שני מצולעים, שלושה קווים ונקודה שווה למרכז הכובד של צורה גיאומטרית שמכילה רק את שני המצולעים.

שימושהחזרות
Point.centroid(maxError, proj)גיאומטריה
ארגומנטסוגפרטים
זה: geometryגיאומטריההפונקציה מחשבת את מרכז הכובד של הצורה הגיאומטרית.
maxErrorErrorMargin, ברירת מחדל: nullהכמות המקסימלית של שגיאות שמותרות כשמבצעים הקרנה מחדש.
projתחזית, ברירת מחדל: nullאם מציינים הקרנה, התוצאה תהיה בהקרנה הזו. אחרת, הוא יהיה ב-EPSG:4326.

דוגמאות

עורך הקוד (JavaScript)

// Define a Point object.
var point = ee.Geometry.Point(-122.082, 37.42);

// Apply the centroid method to the Point object.
var pointCentroid = point.centroid({'maxError': 1});

// Print the result to the console.
print('point.centroid(...) =', pointCentroid);

// Display relevant geometries on the map.
Map.setCenter(-122.085, 37.422, 15);
Map.addLayer(point,
             {'color': 'black'},
             'Geometry [black]: point');
Map.addLayer(pointCentroid,
             {'color': 'red'},
             'Result [red]: point.centroid');

הגדרת Python

מידע על Python API ועל שימוש ב-geemap לפיתוח אינטראקטיבי מופיע בדף Python Environment.

import ee
import geemap.core as geemap

Colab (Python)

# Define a Point object.
point = ee.Geometry.Point(-122.082, 37.42)

# Apply the centroid method to the Point object.
point_centroid = point.centroid(maxError=1)

# Print the result.
display('point.centroid(...) =', point_centroid)

# Display relevant geometries on the map.
m = geemap.Map()
m.set_center(-122.085, 37.422, 15)
m.add_layer(point, {'color': 'black'}, 'Geometry [black]: point')
m.add_layer(point_centroid, {'color': 'red'}, 'Result [red]: point.centroid')
m