ComenzarEmpieza gratis

Intersecting a GeoDataFrame with a Polygon

Combining the land use dataset and the districts dataset, we can now investigate what the land use is in a certain district.

For that, we first need to determine the intersection of the land use dataset with a given district. Let's take again the Muette district as example case.

The land use and districts datasets have already been imported as land_use and districts, and the Muette district has been extracted into the muette shapely polygon. Further, GeoPandas and matplotlib are imported.

Este ejercicio forma parte del curso

Working with Geospatial Data in Python

Ver curso

Instrucciones del ejercicio

  • Calculate the intersection of the land_use polygons with the single muette polygon. Call the result land_use_muette.
  • Make a quick plot of this intersection, and pass edgecolor='black' to more clearly see the boundaries of the different polygons.
  • Print the first five rows of land_use_muette.

Ejercicio interactivo práctico

Prueba este ejercicio completando el código de muestra.

# 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.____)
Editar y ejecutar código