mirrorworld.panoramax: Panoramax

Panoramax, the federated open street-level imagery platform (mostly CC BY-SA 4.0). No key. The federated catalogue api.panoramax.xyz is queried by default; pass api_url= for one instance.

Finding pictures

find_panoramas(lat, lon, radius=25, limit=100, session=None, api_url='https://api.panoramax.xyz/api')[source]

Finds pictures taken within a radius around a point, closest first.

(Panoramax’s own place_position search returns pictures looking at a place instead, which is not what this function does.)

Parameters:
  • lat (float) – Latitude of the center point.

  • lon (float) – Longitude of the center point.

  • radius (float) – (optional) Search radius in meters. Defaults to 25.

  • limit (int) – (optional) Maximum number of results. Defaults to 100.

  • session (Session) – (optional) A requests session.

  • api_url (str) – (optional) Panoramax API to query. Defaults to the federated catalogue.

Returns:

A list of PanoramaxPanorama objects.

Return type:

List[PanoramaxPanorama]

async find_panoramas_async(lat, lon, session, radius=25, limit=100, api_url='https://api.panoramax.xyz/api')[source]
Parameters:
Return type:

List[PanoramaxPanorama]

find_panoramas_in_bbox(north, west, south, east, limit=1000, session=None, api_url='https://api.panoramax.xyz/api')[source]

Finds pictures within a bounding box.

Parameters:
  • north (float) – Latitude of the top edge.

  • west (float) – Longitude of the left edge.

  • south (float) – Latitude of the bottom edge.

  • east (float) – Longitude of the right edge.

  • limit (int) – (optional) Maximum number of results, at most 10000. Defaults to 1000. Split large areas, since results beyond the limit are dropped.

  • session (Session) – (optional) A requests session.

  • api_url (str) – (optional) Panoramax API to query. Defaults to the federated catalogue.

Returns:

A list of PanoramaxPanorama objects.

Return type:

List[PanoramaxPanorama]

async find_panoramas_in_bbox_async(north, west, south, east, session, limit=1000, api_url='https://api.panoramax.xyz/api')[source]
Parameters:
Return type:

List[PanoramaxPanorama]

find_panorama_by_id(panoid, session=None, api_url='https://api.panoramax.xyz/api')[source]

Fetches metadata of a specific picture.

Parameters:
  • panoid (str) – The picture ID.

  • session (Session) – (optional) A requests session.

  • api_url (str) – (optional) Panoramax API to query. Defaults to the federated catalogue.

Returns:

A PanoramaxPanorama object, or None if no picture with this ID exists.

Return type:

PanoramaxPanorama | None

async find_panorama_by_id_async(panoid, session, api_url='https://api.panoramax.xyz/api')[source]
Parameters:
  • panoid (str)

  • session (ClientSession)

  • api_url (str)

Return type:

PanoramaxPanorama | None

get_sequence(sequence_id, session=None, api_url='https://api.panoramax.xyz/api')[source]

Fetches all pictures of a sequence, in capture order.

Parameters:
  • sequence_id (str) – The sequence (collection) ID.

  • session (Session) – (optional) A requests session.

  • api_url (str) – (optional) Panoramax API to query. Defaults to the federated catalogue.

Returns:

A list of PanoramaxPanorama objects.

Return type:

List[PanoramaxPanorama]

async get_sequence_async(sequence_id, session, api_url='https://api.panoramax.xyz/api')[source]
Parameters:
  • sequence_id (str)

  • session (ClientSession)

  • api_url (str)

Return type:

List[PanoramaxPanorama]

Usage sample:

from mirrorworld import panoramax

pics = panoramax.find_panoramas(51.5088, -0.127, radius=30)
print(pics[0].distance, pics[0].date, pics[0].is_equirectangular, pics[0].permalink)

Downloading pictures

get_panorama(pano, size='hd', session=None)[source]

Downloads a picture and returns it as PIL image.

Parameters:
  • pano (PanoramaxPanorama | str) – The picture, or its ID.

  • size (str) – (optional) hd (original resolution), sd or thumb. Defaults to hd.

  • session (Session) – (optional) A requests session.

Returns:

A PIL image.

Return type:

Image

async get_panorama_async(pano, session, size='hd')[source]
Parameters:
Return type:

Image

download_panorama(pano, path, size='hd', pil_args=None, session=None)[source]

Downloads a picture to a file. If the chosen format is JPEG, Exif metadata (and XMP GPano metadata for 360° panoramas) is included.

Parameters:
  • pano (PanoramaxPanorama | str) – The picture, or its ID.

  • path (str) – Output path.

  • size (str) – (optional) hd, sd or thumb. Defaults to hd.

  • pil_args (dict) – (optional) Additional arguments for PIL’s Image.save method, e.g. {"quality":100}. Defaults to {}.

  • session (Session) – (optional) A requests session.

Return type:

None

async download_panorama_async(pano, path, session, size='hd', pil_args=None)[source]
Parameters:
Return type:

None

Usage sample:

panoramax.download_panorama(pics[0], f"{pics[0].id}.jpg", size="hd")

Data classes

class PanoramaxPanorama(id, lat, lon, date=None, heading=None, pitch=None, roll=None, sequence_id=None, rank_in_sequence=None, previous_id=None, next_id=None, field_of_view=None, make=None, model=None, width=None, height=None, horizontal_accuracy=None, producer=None, license=None, instance=None, distance=None, image_urls=None)[source]

Metadata of a Panoramax picture.

Panoramax hosts both 360° panoramas and ordinary photos; is_equirectangular tells them apart. The class is named like the other providers’ for consistency.

Parameters:
  • id (str)

  • lat (float)

  • lon (float)

  • date (datetime | None)

  • heading (float | None)

  • pitch (float | None)

  • roll (float | None)

  • sequence_id (str | None)

  • rank_in_sequence (int | None)

  • previous_id (str | None)

  • next_id (str | None)

  • field_of_view (float | None)

  • make (str | None)

  • model (str | None)

  • width (int | None)

  • height (int | None)

  • horizontal_accuracy (float | None)

  • producer (str | None)

  • license (str | None)

  • instance (str | None)

  • distance (float | None)

  • image_urls (Dict[str, str] | None)

id: str

The picture ID (a UUID).

lat: float

Latitude.

lon: float

Longitude.

date: datetime | None = None

Capture time (timezone-aware).

heading: float | None = None

Heading in radians, where 0 is north and π/2 is east.

pitch: float | None = None

Pitch in radians.

roll: float | None = None

Roll in radians.

sequence_id: str | None = None

ID of the sequence (STAC collection) this picture belongs to.

rank_in_sequence: int | None = None

Position of the picture in its sequence.

previous_id: str | None = None

ID of the previous picture in the sequence.

next_id: str | None = None

ID of the next picture in the sequence.

field_of_view: float | None = None

Horizontal field of view in degrees; 360 for panoramas.

make: str | None = None

Camera make.

model: str | None = None

Camera model.

width: int | None = None

Width of the original image in pixels.

height: int | None = None

Height of the original image in pixels.

horizontal_accuracy: float | None = None

Reported GPS accuracy in meters.

producer: str | None = None

Name of the account that uploaded the picture.

license: str | None = None

SPDX licence identifier, usually CC-BY-SA-4.0.

instance: str | None = None

Panoramax instance that hosts the picture.

distance: float | None = None

Distance from the search point in meters (only set by find_panoramas()).

image_urls: Dict[str, str] | None = None

Image URLs by size: hd (original), sd and thumb.

A link to this picture in the Panoramax viewer.

Miscellaneous

Creates a link to a picture in the Panoramax viewer.

Parameters:
  • id (str) – The picture ID (a UUID).

  • lat (float) – (optional) Latitude of the map center.

  • lon (float) – (optional) Longitude of the map center.

  • zoom (float) – (optional) Zoom level of the map. Defaults to 18.

Returns:

A Panoramax URL.

Return type:

str