google_streetview#

This module defines GoogleStreetview class downloading Google street imagery.

Exceptions#

GoogleStreetViewAPIError

Google rejected a Street View request for a non-coverage reason.

GoogleStreetViewPanoramaMetadataError

Google panorama metadata was unavailable or malformed.

GoogleStreetViewDownloadError

A Street View image could not be downloaded or decoded.

GoogleStreetViewImageUnavailable

Street View metadata exists, but no retrievable image is available.

Classes#

GoogleStreetview

A class that downloads street-level imagery and depth maps for buildings.

Module Contents#

exception openplaces.io.scrapers.google_streetview.GoogleStreetViewAPIError#

Bases: RuntimeError

Google rejected a Street View request for a non-coverage reason.

exception openplaces.io.scrapers.google_streetview.GoogleStreetViewPanoramaMetadataError#

Bases: RuntimeError

Google panorama metadata was unavailable or malformed.

exception openplaces.io.scrapers.google_streetview.GoogleStreetViewDownloadError#

Bases: RuntimeError

A Street View image could not be downloaded or decoded.

exception openplaces.io.scrapers.google_streetview.GoogleStreetViewImageUnavailable#

Bases: RuntimeError

Street View metadata exists, but no retrievable image is available.

class openplaces.io.scrapers.google_streetview.GoogleStreetview(input_data: dict[str, Any])#

A class that downloads street-level imagery and depth maps for buildings.

Interfaces with the Google Street View API to obtain high-resolution street-level images and corresponding depth maps based on specified building footprints.

api_key#

API key for authenticating requests to the Google Street View API.

get_images(inventory: openplaces.io.scrapers.types.AssetInventory, save_directory: str, entity_type: str = 'entity', download_year: int | None = None, redownload: bool = False) openplaces.io.scrapers.types.ImageSet#

Get street-level images of buildings from footprints in AssetInventory.

Parameters:
  • inventory – AssetInventory for which the images will be retrieved.

  • save_directory – Path to the folder where the retrieved images will be saved.

  • entity_type – Type of entity being photographed (e.g. ‘footprint’, ‘parcel’). Used as a filename prefix.

  • download_year – Year the images are fetched; appended as a filename suffix.

  • redownload – Missing images are always fetched. When True, buildings whose image already exists on disk are re-fetched (overwritten) rather than reused.

Returns:

An ImageSet for the assets in the inventory.

Return type:

ImageSet

Raises:

ValueError – If the provided inventory is not an instance of AssetInventory.