This is an module of extensions for the streetview module by robolyst. The functions allows you to collect streetview photos or panoramas among a route just by entering the origin and destination.
This module requires python 3.11.3 or higher.
First, you'll have to install the original streetview module with pip:
pip install streetview
Then install this module with:
pip install git+https://github.com/hhe1ibeb/streetviewext
Get your Directions and Streetview Imagery APIs from https://developers.google.com/maps/
This functions allows you to collect a batch of photos among a route by entering the origin and destination.
Example Code:
from streetviewext import sv_among_route
sv_among_route(
origin="Section 1, Jianguo S Rd, Daan District, Taipei City, 106",
destination="No. 10, Section 4, Ren'ai Rd, Daan District, Taipei City, 106",
mode="driving",
dir_key=GOOGLEMAPS_DIRECTIONS_KEY,
street_key=GOOGLEMAPS_STREETVIEW_KEY,
save_destination="./data", # default to current directory if not specified
save_start_num=2, # default to 1, in this case it'll be "2.jpg", "3.jpg", "4.jpg" ...
# you can also specify value such as width, height, field of view, or pitch
)
It saves a batch of photos to the destination you specify.
- origin: the address of the origin
- destination: the address of the destination
- mode: driving, walking, bicycling, transit, or flight (driving, walking, and bicycling are recommended)
- dir_key: your directions api key, it is recommended to use a .env file to store sensitive data
- street_key: your streetview imagery api key
- save_destination: the directory you wish to save the photos
- save_start_num: the starting index of the filename of the photo
More Functions Coming Soon!