I am trying to obtain Google Street View images of a route between Point A and Point B, and make them into a video.
I found this repository which does exactly what I want. The author mentions that:
Lastly, and trickiest of all: the code requires API keys for Google Map's Street View and Directions APIs. Note: setting up the Street View API now requires a billing account! it tends to be free for small amounts of traffic, but you have to set it up anyway.
I managed to set up a Google Maps API key, and following instructions from Google's website here, I was able to make queries of the form
https://maps.googleapis.com/maps/api/streetview?size=400x400&location=47.5763831,-122.4211769
&fov=80&heading=70&pitch=0&key=YOUR_API_KEY&signature=YOUR_SIGNATURE
and obtain the image that I want.
Now, in the Python code, there's a file street_crawl.py, where the following code is present:
import sys
from utils import *
from API_KEYS import API_KEY_DIRECTIONS, API_KEY_STREETVIEW
'''Google Street View Movie Maker
Usage is:
python2 ./street_crawl.py lat1 lon1 lat2 lon2 output_filestem
For example, to make a one-second video of the entrance of Joshua Treet National Park:
python2 ./street_crawl.py 33.669793 -115.802125 33.671796 -115.801851 joshua_tree
Note: usage requires your own API keys.
'''
def main(lat_lon_A, lat_lon_B, filestem, picsize):
print "Tracing path from ({0}) to ({1})".format(lat_lon_A, lat_lon_B)
# Request driving directions from A to B
gd = googlemaps.Client(key=API_KEY_DIRECTIONS)
I tried running the code as it is given and it gave me an error that:
ImportError: No module named API_KEYS
My question here is - how do I enter my own API key here? Should I just replace the last line with:
gd = googlemaps.Client(key="MY API KEY HERE")
and comment out the call to from API_KEYS import API_KEY_DIRECTIONS, API_KEY_STREETVIEW ?
Or do I have to create a module(file?) called API_KEYS and add my keys in some specific format there?
I am new to Python, so any help would be appreciated.
Thank you.