ee.Geometry.MultiPoint.distance

2 つのジオメトリ間の最小距離を返します。

用途戻り値
MultiPoint.distance(right, maxError, proj, spherical)浮動小数点数
引数タイプ詳細
this: leftジオメトリオペレーションの左オペランドとして使用されるジオメトリ。
rightジオメトリ演算の右オペランドとして使用されるジオメトリ。
maxErrorErrorMargin、デフォルト: null必要な再投影を実行する際に許容される最大エラー量。
proj投影、デフォルト: nullオペレーションを実行する投影。指定しない場合、操作は球面座標系で実行され、直線距離は球面上のメートル単位になります。
sphericalブール値。デフォルト: falsetrue の場合、計算は単位球上で行われます。false の場合、地球の扁平率を考慮した楕円形の計算が行われます。proj が指定されている場合は無視されます。デフォルトは false です。

コードエディタ(JavaScript)

// Define a MultiPoint object.
var multiPoint = ee.Geometry.MultiPoint([[-122.082, 37.420], [-122.081, 37.426]]);

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

// Apply the distance method to the MultiPoint object.
var multiPointDistance = multiPoint.distance({'right': inputGeom, 'maxError': 1});

// Print the result to the console.
print('multiPoint.distance(...) =', multiPointDistance);

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

Python の設定

Python API とインタラクティブな開発での geemap の使用については、 Python 環境のページをご覧ください。

import ee
import geemap.core as geemap

Colab(Python)

# Define a MultiPoint object.
multipoint = ee.Geometry.MultiPoint([[-122.082, 37.420], [-122.081, 37.426]])

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

# Apply the distance method to the MultiPoint object.
multipoint_distance = multipoint.distance(right=input_geom, maxError=1)

# Print the result.
display('multipoint.distance(...) =', multipoint_distance)

# Display relevant geometries on the map.
m = geemap.Map()
m.set_center(-122.085, 37.422, 15)
m.add_layer(multipoint, {'color': 'black'}, 'Geometry [black]: multipoint')
m.add_layer(input_geom, {'color': 'blue'}, 'Parameter [blue]: input_geom')
m