Art distances from neighborhood center
Now that you have the center point and the art locations in the units we need to calculate distances in meters, it's time to perform that step.
This exercise is part of the course
Visualizing Geospatial Data in Python
Exercise instructions
- Import the package to help with pretty printing.
- Create a dictionary,
art_distances
by iterating throughart_dist_meters
, usingtitle
as the key and thedistance()
fromcenter
as the value. Passcenter
as theother
argument toGeoSeries.distance()
. - Pretty print
art_distances
using thepprint
method ofpprint
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Import package for pretty printing
import ____
# Build a dictionary of titles and distances for Urban Residents art
art_distances = {}
for row in ____.iterrows():
vals = row[1]
key = vals['title']
ctr = vals[____]
art_distances[key] = vals['geometry'].distance(____)
# Pretty print the art_distances
____.____(art_distances)