Exercise

Finding the name of the closest National Park

Let's start with a custom query for a single mining site. Here, we will determine the name of the national park that is the closest to the specific mining site.

The datasets on the mining sites (mining_sites) and national parks (national_parks) are already loaded.

Instructions

100 XP
  • Select the first element of geometry and assign it to a variable called single_mine.
  • Calculate the distance from each of the national parks to the single_mine. Call the result dist.
  • Obtain the index for the minimum of dist with the idxmin() method.
  • Get the name of the closest national park using the obtained index with the .loc[] attribute, and print the result.