mirrorworld.kakao: Kakao Road View¶
Finding panoramas¶
- find_panoramas(lat, lon, radius=35, limit=50, session=None)[source]¶
Searches for panoramas 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. 100. Defaults to 35, which is the value used by the KakaoMap client when fetching neighboring panoramas.
limit (int) – (optional) Number of results to return, max. 100. Defaults to 50, which is the value used by the KakaoMap client when fetching neighboring panoramas.
session (Session) – (optional) A requests session.
- Returns:
A list of KakaoPanorama objects.
- Return type:
Usage sample:
from mirrorworld import kakao panos = kakao.find_panoramas(37.4481486, 126.4509719) print(panos[0].lat, panos[0].lon) print(panos[0].id) print(panos[0].date)Usage sample:
from mirrorworld import kakao from aiohttp import ClientSession async with ClientSession() as session: panos = await kakao.find_panoramas_async(37.4481486, 126.4509719, session) print(panos[0].lat, panos[0].lon) print(panos[0].id) print(panos[0].date)
- find_panorama_by_id(panoid, neighbors=True, session=None)[source]¶
Fetches metadata of a specific panorama.
This call only appears to work for the most recent coverage at a location. IDs of older panoramas will return nothing even though they exist.
- Parameters:
- Returns:
A KakaoPanorama object if a panorama with this ID was found, or None.
- Return type:
KakaoPanorama | None
Usage sample:
from mirrorworld import kakao pano = kakao.find_panorama_by_id(1168949345) print(pano.lat, pano.lon) print(pano.date) print(pano.address)
- async find_panorama_by_id_async(panoid, session, neighbors=True)[source]¶
- Parameters:
- Return type:
KakaoPanorama | None
Usage sample:
from mirrorworld import kakao from aiohttp import ClientSession async with ClientSession() as session: pano = await kakao.find_panorama_by_id_async(1168949345, session) print(pano.lat, pano.lon) print(pano.date) print(pano.address)
Downloading panoramas¶
- get_panorama(pano, zoom=2)[source]¶
Downloads a panorama and returns it as PIL image.
- Parameters:
pano (KakaoPanorama) – The panorama to download.
zoom (int) – (optional) Image size; 0 is lowest, 2 is highest. Defaults to 2. If 2 is unavailable, 1 will be downloaded.
- Returns:
A PIL image containing the panorama.
- Return type:
Image
- async get_panorama_async(pano, session, zoom=2)[source]¶
- Parameters:
pano (KakaoPanorama)
session (ClientSession)
zoom (int)
- Return type:
Image
- download_panorama(pano, path, zoom=2, pil_args=None)[source]¶
Downloads a panorama to a file. If the chosen format is JPEG, Exif and XMP GPano metadata are included.
- Parameters:
pano (KakaoPanorama) – The panorama to download.
path (str) – Output path.
zoom (int) – (optional) Image size; 0 is lowest, 2 is highest. Defaults to 2. If 2 is unavailable, 1 will be downloaded.
pil_args (dict) – (optional) Additional arguments for PIL’s Image.save method, e.g.
{"quality":100}. Defaults to{}.- Return type:
None
Usage sample:
from mirrorworld import kakao pano = kakao.find_panorama_by_id(1168949345) kakao.download_panorama(pano, f"{pano.id}.jpg")
- async download_panorama_async(pano, path, session, zoom=2, pil_args=None)[source]¶
- Parameters:
pano (KakaoPanorama)
path (str)
session (ClientSession)
zoom (int)
pil_args (dict)
- Return type:
None
Usage sample:
from mirrorworld import kakao from aiohttp import ClientSession async with ClientSession() as session: pano = await kakao.find_panorama_by_id_async(1168949345, session) await kakao.download_panorama(pano, f"{pano.id}.jpg")
- get_depthmap(pano, session=None)[source]¶
Downloads the depth map of a panorama and returns it as PIL image.
- Parameters:
pano (KakaoPanorama) – The panorama.
session (Session) – (optional) A requests session.
- Returns:
The depth map as PIL Image.
- Return type:
Image
- async get_depthmap_async(pano, session)[source]¶
- Parameters:
pano (KakaoPanorama)
session (ClientSession)
- Return type:
Image
- download_depthmap(pano, path, session=None)[source]¶
Downloads the depth map of a panorama to a PNG file.
- Parameters:
pano (KakaoPanorama) – The panorama.
path (str) – Output path.
session (Session) – (optional) A requests session.
- Return type:
None
- async download_depthmap_async(pano, path, session)[source]¶
- Parameters:
pano (KakaoPanorama)
path (str)
session (ClientSession)
- Return type:
None
Data classes and enums¶
- class KakaoPanorama(id, lat, lon, heading=None, wcongx=None, wcongy=None, image_path=None, neighbors=None, links=None, historical=None, date=None, street_name=None, address=None, street_type=None, panorama_type=None)[source]¶
Metadata of a Kakao Road View panorama.
ID, latitude and longitude are always present. The availability of other metadata depends on which function was called and what was returned by the API.
- Parameters:
- heading: float = None¶
Heading in radians, where 0° is north, 90° is east, 180° is south and 270° is west.
- neighbors: List[KakaoPanorama] = None¶
A list of nearby panoramas.
- historical: List[KakaoPanorama] = None¶
A list of panoramas with a different date at the same location. Only available if the panorama was retrieved by
find_panorama_by_id.
- address: str = None¶
The address of the location as shown in the top-left corner in the panorama viewer.
- panorama_type: PanoramaType = None¶
The panorama type and/or the camera the panorama was taken with. Identifiers are taken directly from the source.
- permalink(heading=0.0, pitch=0.0, radians=False)[source]¶
Creates a permalink to a panorama at this location.
The link will only work as expected for the most recent coverage at a location – it does not appear to be possible to directly link to older panoramas.
- Parameters:
heading (float) – (optional) Initial heading of the viewport. Defaults to 0°.
pitch (float) – (optional) Initial pitch of the viewport. Defaults to 0°.
radians (bool) – (optional) Whether angles are in radians. Defaults to False.
self (KakaoPanorama)
- Returns:
A KakaoMap URL.
- Return type:
Miscellaneous¶
- build_permalink(id=None, wcongx=None, wcongy=None, heading=0.0, pitch=0.0, radians=False)[source]¶
Creates a permalink to a panorama. All parameters are optional, but either a location, or a pano ID, or both must be passed.
When linking by ID, the link will only work as expected for the most recent coverage at a location – it does not appear to be possible to directly link to older panoramas.
- Parameters:
id (int) – (optional) The pano ID.
wcongx (float) – (optional) X coordinate of the panorama’s location in the WCongnamul coordinate system.
wcongy (float) – (optional) Y coordinate of the panorama’s location in the WCongnamul coordinate system.
heading (float) – (optional) Initial heading of the viewport. Defaults to 0°.
pitch (float) – (optional) Initial pitch of the viewport. Defaults to 0°.
radians (bool) – (optional) Whether angles are in radians. Defaults to False.
- Returns:
A KakaoMap URL which will open the given panorama.
- Return type: