시작하기무료로 시작하기

Urban Residents 동네의 중심점

이제 urban_poly_3857의 중심점을 구하고, 그 점을 폴리곤 위에 표시해 보세요.

이 연습은 강의의 일부입니다

Python으로 지리공간 데이터 시각화하기

강의 보기

연습 안내

  • GeoSeries의 centroid 속성을 사용해 urban_poly_3857에서 downtown_center를 만드세요.
  • downtown_center의 데이터 타입을 출력하세요.
  • urban_poly_3857ax로 플로팅하고 색상은 lightgreen으로 설정하세요.
  • downtown_center를 플로팅할 때 ax = ax, color = black로 설정하세요. x축 눈금 회전은 미리 해두었습니다. 플롯을 표시하는 코드는 포함되어 있습니다.

실습형 인터랙티브 연습

이 예제를 이 샘플 코드를 완성하여 풀어보세요.

# Create downtown_center from urban_poly_3857
downtown_center = urban_poly_3857.____.____

# Print the type of downtown_center 
print(type(downtown_center))

# Plot the urban_poly_3857 as ax and add the center point
ax = ____.plot(color = 'lightgreen')
____.plot(ax = ____, color = 'black')
plt.xticks(rotation = 45)

# Show the plot
plt.show()
코드 편집 및 실행