Session Ready
Exercise

How far is the closest restaurant?

Now, we might be interested in the restaurants nearby the Eiffel Tower. To explore them, let's visualize the Eiffel Tower itself as well as the restaurants within 1km.

To do this, we can calculate the distance to the Eiffel Tower for each of the restaurants. Based on this result, we can then create a mask that takes True if the restaurant is within 1km, and False otherwise, and use it to filter the restaurants GeoDataFrame. Finally, we make a visualization of this subset.

The restaurants GeoDataFrame has been loaded, and the eiffel_tower object created. Further, matplotlib, GeoPandas and contextily have been imported.

Instructions
100 XP
  • Calculate the distance to the Eiffel Tower for each restaurant, and call the result dist_eiffel.
  • Print the distance to the closest restaurant (which is the minimum of dist_eiffel).
  • Select the rows the restaurants GeoDataFrame where the distance to the Eiffel Tower is less than 1 km (note that the distance is in meters).