ee.FeatureCollection.distance

각 픽셀이 컬렉션에서 픽셀 중심에서 가장 가까운 Point, LineString 또는 다각형 경계까지의 거리(미터)인 DOUBLE 이미지를 생성합니다.

거리는 다각형 내부에서도 측정됩니다. 기하 도형의 'searchRadius' 미터 내에 있지 않은 픽셀은 마스크 처리됩니다.

거리는 구에서 계산되므로 각 픽셀과 가장 가까운 기하 도형 간의 위도 차이에 비례하는 작은 오류가 있습니다.

사용반환 값
FeatureCollection.distance(searchRadius, maxError)이미지
인수유형세부정보
this: featuresFeatureCollection픽셀 거리를 계산하는 데 사용되는 특성을 가져올 특성 컬렉션입니다.
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');

Python 설정

Python API 및 대화형 개발을 위한 geemap 사용에 관한 자세한 내용은 Python 환경 페이지를 참고하세요.

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