Get startedGet started for free

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.

This exercise is part of the course

Working with Geospatial Data in Python

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Read the trees and districts data
trees = ____
districts = ____

# The trees dataset with point locations of trees
print(trees.head())
Edit and Run Code