투영 좌표계에서 거리 계산하기
이제 에펠탑 위치가 투영 좌표계로 되어 있으니, 다른 지점까지의 거리를 계산할 수 있어요.
이전 연습 문제의 투영된 Point를 담은 최종 s_eiffel_tower_projected가 이미 제공되며, 여기서 단일 포인트를 추출해 eiffel_tower 변수에 넣었어요. 또한 WGS84 좌표를 사용하는 restaurants 데이터프레임도 로드되어 있어요.
이 연습은 강의의 일부입니다
Python으로 지리공간 데이터 다루기
연습 안내
restaurants를 에펠탑 포인트와 같은 CRS로 변환하세요. 이 연습에서는epsg키워드를 지정하지 말고.crs속성을 활용하세요.- 모든 레스토랑에서 에펠탑까지의 거리를 계산하세요.
- 가장 작은 거리를 출력하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Extract the single Point
eiffel_tower = s_eiffel_tower_projected[0]
# Ensure the restaurants use the same CRS
restaurants = restaurants.____
# The distance from each restaurant to the Eiffel Tower
dist_eiffel = ____
# The distance to the closest restaurant
print(____)