Street views of churches

Jingyuan Gao
Data Mining the City
4 min readSep 23, 2017
import csv
import urllib
import locationscsv
locations = []
reader = csv.reader(locationscsv.data.splitlines())
is_first_row = True
for row in reader:
if is_first_row:
is_first_row = False
continue
lat, lon = float(row[0]), float(row[1])
location = (lat, lon)
locations.append(location)
api_key = "AIzaSyCi7PDdbdQ3qGFjcTo57E4Y579C7fiDmis"api_url = "https://maps.googleapis.com/maps/api/streetview?size=640x400&location={0},{1}&fov=90&heading={2}&pitch=10&key={3}"
row = 2
headings = [0, 90, 180, 270]
for location in locations:
for direction in headings:
lat, lon = location
url = api_url.format(lat, lon, direction, api_key)
filename = "location-{0}-{1}.jpg".format(row, direction) urllib.urlretrieve(url, filename)
print "Got %s" % (filename,)
row += 1

--

--