ee.Geometry.Point.distance

แสดงผลระยะทางต่ำสุดระหว่างเรขาคณิต 2 รายการ

การใช้งานการคืนสินค้า
Point.distance(right, maxError, proj, spherical)ทศนิยม
อาร์กิวเมนต์ประเภทรายละเอียด
ดังนี้ leftเรขาคณิตเรขาคณิตที่ใช้เป็นตัวถูกดำเนินการด้านซ้ายของการดำเนินการ
rightเรขาคณิตเรขาคณิตที่ใช้เป็นตัวถูกดำเนินการด้านขวาของการดำเนินการ
maxErrorErrorMargin, ค่าเริ่มต้น: nullปริมาณข้อผิดพลาดสูงสุดที่ยอมรับได้เมื่อทำการฉายซ้ำที่จำเป็น
projการฉายภาพ ค่าเริ่มต้น: nullการฉายภาพที่จะใช้ดำเนินการ หากไม่ได้ระบุ ระบบจะดำเนินการในระบบพิกัดทรงกลม และระยะทางเชิงเส้นจะเป็นหน่วยเมตรบนทรงกลม
sphericalบูลีน ค่าเริ่มต้น: falseหากเป็นจริง ระบบจะคำนวณบนทรงกลมหน่วย หากเป็นเท็จ การคำนวณจะเป็นวงรีโดยคำนึงถึงความแบนของโลก จะไม่สนใจหากมีการระบุ proj ค่าเริ่มต้นคือ False

ตัวอย่าง

โปรแกรมแก้ไขโค้ด (JavaScript)

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

// Define other inputs.
var inputGeom = ee.Geometry.Point(-122.090, 37.423);

// Apply the distance method to the Point object.
var pointDistance = point.distance({'right': inputGeom, 'maxError': 1});

// Print the result to the console.
print('point.distance(...) =', pointDistance);

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

การตั้งค่า Python

ดูข้อมูลเกี่ยวกับ Python API และการใช้ geemap เพื่อการพัฒนาแบบอินเทอร์แอกทีฟได้ที่หน้า สภาพแวดล้อม Python

import ee
import geemap.core as geemap

Colab (Python)

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

# Define other inputs.
input_geom = ee.Geometry.Point(-122.090, 37.423)

# Apply the distance method to the Point object.
point_distance = point.distance(right=input_geom, maxError=1)

# Print the result.
display('point.distance(...) =', point_distance)

# 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(input_geom, {'color': 'blue'}, 'Parameter [blue]: input_geom')
m