Polygon과 GeoDataFrame의 교차 구하기
토지 이용(land use) 데이터셋과 구역(districts) 데이터셋을 결합하면, 특정 구역의 토지 이용이 무엇인지 살펴볼 수 있어요.
이를 위해 먼저 주어진 구역과 토지 이용 데이터셋의 교차 영역을 계산해야 해요. 예시로 다시 Muette 구역을 사용해 보겠습니다.
토지 이용과 구역 데이터셋은 각각 land_use, districts로 이미 불러왔고, Muette 구역은 muette라는 shapely polygon으로 추출해 두었어요. 또한 GeoPandas와 matplotlib도 import되어 있어요.
이 연습은 강의의 일부입니다
Python으로 지리공간 데이터 다루기
연습 안내
- 여러
land_usepolygon을 단일muettepolygon과 교차시켜 교차 결과를 계산하세요. 결과 이름은land_use_muette로 하세요. - 이 교차 결과를 빠르게 시각화하고, 서로 다른 polygon 경계를 더 잘 보이게 하도록
edgecolor='black'을 지정하세요. land_use_muette의 처음 다섯 행을 출력하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Print the land use datset and Notre-Dame district polygon
print(land_use.head())
print(type(muette))
# Calculate the intersection of the land use polygons with Notre Dame
land_use_muette = ____
# Plot the intersection
land_use_muette.____
plt.show()
# Print the first five rows of the intersection
print(land_use_muette.____)