A module to download images from Google Street View.
Project description
street_view_image_downloader
The street_view_image_downloader
package provides an easy way to download images from Google Street View, based on specified latitude and longitude. One of the highlighted features is the ability to switch between multiple API keys after a set number of images, useful for projects requiring a large number of downloads.
Installation
pip install street_view_image_downloader
Before you use this package, make sure you have the following libraries installed:
pip install requests
pip install pillow
Usage
1. Initialize the StreetViewDownloader:
from street_view_image_downloader import StreetViewDownloader
api_key = "YOUR_API_KEY"
downloader = StreetViewDownloader(api_key)
2. Download a Single Image:
lat, lng = 37.4219999,-122.0840575
downloader.download_image(lat, lng)
3. Download Multiple Images from a CSV:
The CSV file should have at least two columns labeled latitude
and longitude
.
downloader.batch_download('test_data.csv', output_folder='test_images')
4. Switching Between Multiple API Keys:
If you have multiple API keys and wish to switch between them after a certain number of images:
api_keys_list = ['YOUR_FIRST_API_KEY', 'YOUR_SECOND_API_KEY']
downloader.batch_download('test_data.csv', output_folder='test_images_with_keys', api_keys=api_keys_list, images_per_key=3)
5. Download Panoramic Images:
downloader.download_image(lat, lng, panorama=True)
6. Batch Download of Panoramas with API Key Switching:
downloader.batch_download('test_data.csv', output_folder='panorama_images_with_keys', api_keys=api_keys_list, images_per_key=3, panorama=True)
Function Parameters:
-
download_image():
lat, lng
: Coordinates for the image location.size
: Image size (default is '640x480').fov
: Field of view (default is 90).heading
: Direction of the camera (default is 0).pitch
: Vertical angle of the camera (default is 0).radius
: Defines search radius in meters (default is 50).source
: Source of image (default is 'default').params
: Additional parameters to add to the URL (default is None).output_folder
: Folder to save the image (default is the current directory).panorama
: Download and stitch images from four different headings to create a panoramic image (default is False).
-
batch_download():
csv_file
: Path to the CSV file withlatitude
andlongitude
columns.output_folder
: Folder to save the images.api_keys
: List of API keys to switch between.images_per_key
: Number of images to download before switching to the next API key.panorama
: Download panoramic images (default is False).- Other parameters are the same as
download_image
.
Important Note:
Ensure that your API keys have the necessary permissions and quota to access and download from Google Street View. The API key switching feature is particularly useful to distribute the load across multiple keys and stay within the quota limits.
Happy downloading!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for street_view_image_downloader-0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d219c588d9ac00256a6c9787cbc2acd1bba49b17c58be5b1b9b0b8b1d75cabc |
|
MD5 | 35d13d213fcfe053a4b2d756a8d29b97 |
|
BLAKE2b-256 | b000aba86257f99f5f0034a394fb8ad90b6de8d77c75e303c7d1e3a2c9292bc3 |
Hashes for street_view_image_downloader-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fda5fe75f0f304ffaf3454f8835a81c5f1fd1aab416d8376e47779089621439d |
|
MD5 | fe8bcb897fb1290a20f925a402219467 |
|
BLAKE2b-256 | 76c5ec8269a07e0a70749171ecaaaa02dedab2ee26bd7f63f00129f1b0a6059c |