社区中心到艺术点的距离
既然已经有了中心点和以米为单位的艺术位置数据,接下来就可以计算距离了。
本练习是课程的一部分
在 Python 中可视化地理空间数据
练习说明
- 导入用于美化打印的包。
- 通过遍历
art_dist_meters创建字典art_distances,将title作为键,将从center出发的distance()作为值。将center作为GeoSeries.distance()的other参数传入。 - 使用
pprint的pprint方法美化打印art_distances。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# 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)