ee.Geometry.Point.centroid

نقطه ای را در مرکز مولفه های با بالاترین بعد هندسه برمی گرداند. مولفه‌های ابعاد پایین‌تر نادیده گرفته می‌شوند، بنابراین مرکز یک هندسه شامل دو چند ضلعی، سه خط و یک نقطه معادل مرکز هندسه‌ای است که فقط شامل دو چندضلعی است.

استفاده برمی گرداند
Point. centroid ( maxError , proj ) هندسه
استدلال تایپ کنید جزئیات
این: geometry هندسه مرکز این هندسه را محاسبه می کند.
maxError ErrorMargin، پیش فرض: null حداکثر مقدار خطای قابل تحمل هنگام انجام هر گونه بازطراحی ضروری.
proj Projection، پیش فرض: null اگر مشخص شود، نتیجه در این طرح خواهد بود. در غیر این صورت در EPSG:4326 خواهد بود.

نمونه ها

ویرایشگر کد (جاوا اسکریپت)

// 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');

راه اندازی پایتون

برای اطلاعات در مورد API پایتون و استفاده از geemap برای توسعه تعاملی به صفحه محیط پایتون مراجعه کنید.

import ee
import geemap.core as geemap

کولب (پایتون)

# 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