Skip to main content

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 with latitude and longitude 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

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

street_view_image_downloader-0.1.tar.gz (5.0 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page