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 للحصول على معلومات حول واجهة برمجة التطبيقات Python واستخدام geemap للتطوير التفاعلي.

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