ee.Geometry.LinearRing.distance

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

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

コードエディタ(JavaScript)

// Define a LinearRing object.
var linearRing = ee.Geometry.LinearRing(
    [[-122.091, 37.420],
     [-122.085, 37.422],
     [-122.080, 37.430]]);

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

// Apply the distance method to the LinearRing object.
var linearRingDistance = linearRing.distance({'right': inputGeom, 'maxError': 1});

// Print the result to the console.
print('linearRing.distance(...) =', linearRingDistance);

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

Python の設定

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

import ee
import geemap.core as geemap

Colab(Python)

# Define a LinearRing object.
linearring = ee.Geometry.LinearRing(
    [[-122.091, 37.420], [-122.085, 37.422], [-122.080, 37.430]]
)

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

# Apply the distance method to the LinearRing object.
linearring_distance = linearring.distance(right=input_geom, maxError=1)

# Print the result.
display('linearring.distance(...) =', linearring_distance)

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