距離はポリゴンの内部でも測定されます。ジオメトリから「searchRadius」メートル以内のピクセルはマスクされます。
距離は球体上で計算されるため、各ピクセルと最も近いジオメトリの緯度の差に比例した小さな誤差が生じます。
| 用途 | 戻り値 |
|---|---|
FeatureCollection.distance(searchRadius, maxError) | 画像 |
| 引数 | タイプ | 詳細 |
|---|---|---|
これ: features | FeatureCollection | ピクセル距離の計算に使用される特徴を取得する特徴コレクション。 |
searchRadius | 浮動小数点数、デフォルト: 100000 | 各ピクセルからエッジを探す最大距離(メートル単位)。この距離内にエッジがない限り、ピクセルはマスクされます。 |
maxError | 浮動小数点数、デフォルト: 100 | 再投影が必要な入力ポリラインの場合にのみ使用される、再投影誤差の最大値(メートル単位)。「0」が指定されている場合、射影が必要な場合、このオペレーションは失敗します。 |
例
コードエディタ(JavaScript)
// FeatureCollection of power plants in Belgium. var fc = ee.FeatureCollection('WRI/GPPD/power_plants') .filter('country_lg == "Belgium"'); // Generate an image of distance to nearest power plant. var distance = fc.distance({searchRadius: 50000, maxError: 50}); // Display the image and FeatureCollection on the map. Map.setCenter(4.56, 50.78, 7); Map.addLayer(distance, {max: 50000}, 'Distance to power plants'); Map.addLayer(fc, {color: 'red'}, 'Power plants');
import ee import geemap.core as geemap
Colab(Python)
# FeatureCollection of power plants in Belgium. fc = ee.FeatureCollection('WRI/GPPD/power_plants').filter( 'country_lg == "Belgium"' ) # Generate an image of distance to nearest power plant. distance = fc.distance(searchRadius=50000, maxError=50) # Display the image and FeatureCollection on the map. m = geemap.Map() m.set_center(4.56, 50.78, 7) m.add_layer(distance, {'max': 50000}, 'Distance to power plants') m.add_layer(fc, {'color': 'red'}, 'Power plants') m