1. Learn
  2. /
  3. Courses
  4. /
  5. Working with Geospatial Data in Python

Connected

Exercise

Map of tree density by district (1)

Using a dataset of all trees in public spaces in Paris, the goal is to make a map of the tree density by district. For this, we first need to find out how many trees each district contains, which we will do in this exercise. In the following exercise, we will then use this result to calculate the density and create a map.

To obtain the tree count by district, we first need to know in which district each tree is located, which we can do with a spatial join. Then, using the result of the spatial join, we will calculate the number of trees located in each district using the pandas 'group-by' functionality.

GeoPandas has been imported as geopandas.

Instructions 1/3

undefined XP
    1
    2
    3
  • Import the trees dataset "paris_trees.gpkg" and call the result trees. Also read the districts dataset we have seen previously ("paris_districts_utm.geojson"), and call this districts.