All I wanted was that my wallpapers are random Street View images. Google provides an API to download Street View photos, but the maximum size is 640x640. This script hacks around that limitation by taking a screenshot of images as they are rendered in a browser.
- Python 3.7
- Python modules in requirements.txt
- Chrome browser
- A compatible Chrome webdriver (current chromedriver.exe in this repo is compatible with Chrome 83)
- Google API key set to use Street View Static API and Maps JavaScript API
- Clone or download this repo.
- Edit save_random_view.py to add your key into
API_KEY
variable. - Edit clean_street_view.html to add your key into
https://maps.googleapis.com/maps/api/js?key=ADD_YOUR_KEY-HERE&callback=initPano
- Run
python save_random_view.py
- Random street view clean image will be in images folder
Script uses polygons (formatted as a set of coordinates) to limit the area of images. Current repo has 2 polygons roughly covering all land on Earth. You can use custom polygons to limit the images to more specific regions.
Because there isn't a smart way to get a valid Street View coordinate, the script may take several seconds to finish. Smaller polygons may help.