Skip to main content

Retrieve current and historical photos from Google Street View

Project description

streetview

PyPI version PyPI Downloads

This is a light module for downloading photos from Google street view. The functions allow you to retrieve current and old photos. Google does have an API for accessing Street View. However, it does not allow you to access old photos. Their javascript API allows you to download segments of current photos. This API also allows you to download each full panorama as you see it on Google Street View.

Please note, Google does not maintain the access points used by this API for public use. Therefore, this hack may break if Google makes changes to how Street View works.

Install

Install from pip with:

pip install streetview

Quick start

Search for Panoramas

The photos on Google street view are panoramas. Each parnorama has its own unique ID. Retrieving photos is a two step process. First, you must translate GPS coordinates into panorama IDs. The following code retrieves a list of the closest panoramas:

from streetview import search_panoramas

panos = search_panoramas(lat=41.8982208, lon=12.4764804)
first = panos[0]

print(first)
# pano_id='_R1mwpMkiqa2p0zp48EBJg' lat=41.89820676786453 lon=12.47644220919742 heading=0.8815613985061646 pitch=89.001953125 roll=0.1744659692049026 date='2019-08'

Get Metadata

Not all panoramas will have a date field in the search results. You can fetch a date for any valid panorama from the metadata api:

from streetview import get_panorama_meta

meta = get_panorama_meta(pano_id='_R1mwpMkiqa2p0zp48EBJg', api_key=GOOGLE_MAPS_API_KEY)

print(meta)
# date='2019-08' location=Location(lat=41.89820659475458, lng=12.47644649615282) pano_id='_R1mwpMkiqa2p0zp48EBJg'

Download streetview image

You can then use the panorama ids to download streetview images:

from streetview import get_streetview

image = get_streetview(
    pano_id="z80QZ1_QgCbYwj7RrmlS0Q",
    api_key=GOOGLE_MAPS_API_KEY,
)

image.save("image.jpg", "jpeg")

Download panorama

You can download a full panorama like this:

from streetview import get_panorama

image = get_panorama(pano_id="z80QZ1_QgCbYwj7RrmlS0Q")

image.save("image.jpg", "jpeg")

To download the panorama in an asynchronous context:

from streetview import get_panorama_async

image = await get_panorama_async(pano_id="z80QZ1_QgCbYwj7RrmlS0Q")

image.save("image.jpg", "jpeg")

Project details


Download files

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

Source Distribution

streetview_mrexcel-0.0.17.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

streetview_mrexcel-0.0.17-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file streetview_mrexcel-0.0.17.tar.gz.

File metadata

  • Download URL: streetview_mrexcel-0.0.17.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.22

File hashes

Hashes for streetview_mrexcel-0.0.17.tar.gz
Algorithm Hash digest
SHA256 70f845aab24347f2b1500a582631c932df3d302157a542b4788ee5805ff4c7ad
MD5 d43b41b3645b1dc635b51a7f27d5bc6a
BLAKE2b-256 23546200edfd772dfc7b1dc0fbb63ac3605b0ba7e8317a69b250f322f83c900e

See more details on using hashes here.

File details

Details for the file streetview_mrexcel-0.0.17-py3-none-any.whl.

File metadata

File hashes

Hashes for streetview_mrexcel-0.0.17-py3-none-any.whl
Algorithm Hash digest
SHA256 49ee1f03e21039a6bcbdff1d2c975418024111f4f4b642d7bb5d60c3441f2ff2
MD5 b037bc58d7e204c14c1e34a7aecac54d
BLAKE2b-256 2864502b8beaf9f2100845c22c7bf50338c40facbd92065051c9238beea468f3

See more details on using hashes here.

Supported by

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