거리는 다각형 내부에서도 측정됩니다. 기하 도형의 'searchRadius' 미터 내에 있지 않은 픽셀은 마스크 처리됩니다.
거리는 구에서 계산되므로 각 픽셀과 가장 가까운 기하 도형 간의 위도 차이에 비례하는 작은 오류가 있습니다.
| 사용 | 반환 값 |
|---|---|
FeatureCollection.distance(searchRadius, maxError) | 이미지 |
| 인수 | 유형 | 세부정보 |
|---|---|---|
this: 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