streetlevel.ja: Já 360
Finding panoramas
- find_panorama(lat, lon, radius=100, session=None)
Searches for a panorama within a radius around a point.
- Parameters:
lat (float) – Latitude of the center point.
lon (float) – Longitude of the center point.
radius (int) – (optional) Search radius in meters, max. 5000(?). Defaults to 100.
session (Session | None) – (optional) A requests session.
- Returns:
A JaPanorama if a panorama was found, or None.
- Return type:
JaPanorama | None
Usage sample:
from streetlevel import ja pano = ja.find_panorama(64.149726, -21.940347) print(pano.id) print(pano.lat, pano.lon) print(pano.heading)
- async find_panorama_async(lat, lon, session, radius=100)
- Parameters:
lat (float)
lon (float)
session (ClientSession)
radius (int)
- Return type:
JaPanorama | None
Usage sample:
from streetlevel import ja from aiohttp import ClientSession async with ClientSession() as session: pano = await ja.find_panorama_async(64.149726, -21.940347, session) print(pano.id) print(pano.lat, pano.lon) print(pano.heading)
- find_panorama_by_id(panoid, session=None)
Fetches metadata of a specific panorama.
- Parameters:
panoid (int) – The pano ID.
session (Session | None) – (optional) A requests session.
- Returns:
A JaPanorama object if a panorama with this ID was found, or None.
- Return type:
JaPanorama | None
Usage sample:
from streetlevel import ja pano = ja.find_panorama_by_id(2962469) print(pano.lat, pano.lon) print(pano.date) print(pano.address)
- async find_panorama_by_id_async(panoid, session)
- Parameters:
panoid (int)
session (ClientSession)
- Return type:
JaPanorama | None
Usage sample:
from streetlevel import ja from aiohttp import ClientSession async with ClientSession() as session: pano = await ja.find_panorama_by_id_async(2962469, session) print(pano.lat, pano.lon) print(pano.date) print(pano.address)
Downloading panoramas
- get_panorama(pano, zoom=0, stitching_method=CubemapStitchingMethod.ROW)
Downloads a panorama and returns it as PIL image.
- Parameters:
pano (JaPanorama) – The panorama.
zoom (int) – (optional) Image size; 0 is high, 1 is low. Defaults to 0.
stitching_method (CubemapStitchingMethod) – (optional) Whether and how the faces of the cubemap are stitched into one image. Defaults to
ROW.- Returns:
A PIL image or a list of six PIL images depending on
stitching_method.- Return type:
List[Image] | Image
- async get_panorama_async(pano, session, zoom=0, stitching_method=CubemapStitchingMethod.ROW)
- Parameters:
pano (JaPanorama)
session (ClientSession)
zoom (int)
stitching_method (CubemapStitchingMethod)
- Return type:
List[Image] | Image
- download_panorama(pano, path, zoom=0, stitching_method=CubemapStitchingMethod.ROW, pil_args=None)
Downloads a panorama to a file.
- Parameters:
pano (JaPanorama) – The panorama.
path (str) – Output path.
zoom (int) – (optional) Image size; 0 is high, 1 is low. Defaults to 0.
stitching_method (CubemapStitchingMethod) – (optional) Whether and how the faces of the cubemap are stitched into one image. Defaults to
ROW.pil_args (dict | None) – (optional) Additional arguments for PIL’s Image.save method, e.g.
{"quality":100}. Defaults to{}.- Return type:
None
Usage sample:
from streetlevel import ja pano = ja.find_panorama_by_id(2962469) ja.download_panorama(pano, f"{pano.id}.jpg")
- async download_panorama_async(pano, path, session, zoom=0, stitching_method=CubemapStitchingMethod.ROW, pil_args=None)
- Parameters:
pano (JaPanorama)
path (str)
session (ClientSession)
zoom (int)
stitching_method (CubemapStitchingMethod)
pil_args (dict | None)
- Return type:
None
Usage sample:
from streetlevel import ja from aiohttp import ClientSession async with ClientSession() as session: pano = await ja.find_panorama_by_id_async(2962469, session) await ja.download_panorama_async(pano, f"{pano.id}.jpg", session)
Data classes
- class Address(street_name_and_house_number, postal_code, place)
Nearest address to a Já 360 panorama.
- Parameters:
street_name_and_house_number (str)
postal_code (int)
place (str)
- place: str
- postal_code: int
- street_name_and_house_number: str
- class CaptureDate(year, month)
Capture date of a Já 360 panorama.
- Parameters:
year (int)
month (int)
- month: int
The month the panorama was taken.
- year: int
The year the panorama was taken.
- class JaPanorama(id, lat, lon, heading, neighbors=None, date=None, pano_url=None, blur_key=None, street_names=None, address=None)
Metadata of a Já 360 panorama.
ID, latitude, longitude and heading are always present. The availability of other metadata depends on which function was called and what was returned by the API.
- Parameters:
id (int)
lat (float)
lon (float)
heading (float)
neighbors (List[JaPanorama])
date (CaptureDate)
pano_url (str)
blur_key (int)
street_names (List[StreetLabel])
address (Address)
- blur_key: int = None
Part of the panorama tile URL.
- date: CaptureDate = None
The month and year the panorama was captured.
- heading: float
Heading in radians, where 0° is north, 90° is east, 180° is south and 270° is west.
- id: int
The pano ID.
- lat: float
Latitude of the panorama’s location.
- lon: float
Longitude of the panorama’s location.
- neighbors: List[JaPanorama] = None
A list of nearby panoramas.
- pano_url: str = None
Part of the panorama tile URL.
- permalink(heading=0.0, radians=False)
Creates a permalink to a panorama at this location. Directly linking to a specific panorama by its ID does not appear to be possible.
- Parameters:
heading (float) – (optional) Initial heading of the viewport. Defaults to 0°.
radians (bool) – (optional) Whether angles are in radians. Defaults to False.
self (JaPanorama)
- Returns:
A Já.is Kort URL which will open the panorama at this location.
- Return type:
str
- street_names: List[StreetLabel] = None
Street name labels overlaid on this panorama, featuring the name of the street(s) the panorama is located on and the angles that the label appears at.
The first entry is the name of the street the panorama is located on; subsequent entries label nearby streets at junctions.
Note that
distanceisNonefor the first entry.
Miscellaneous
- build_permalink(lat, lon, heading=0.0, radians=False)
Creates a permalink to the closest panorama to the given location. Directly linking to a specific panorama by its ID does not appear to be possible.
- Parameters:
lat (float) – Latitude of the panorama’s location.
lon (float) – Longitude of the panorama’s location.
heading (float) – (optional) Initial heading of the viewport. Defaults to 0°.
radians (bool) – (optional) Whether angles are in radians. Defaults to False.
- Returns:
A Já.is Kort URL which will open the closest panorama to the given location.
- Return type:
str