Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
sk-zk committed Mar 12, 2024
2 parents fb47419 + 6b6dc6c commit fdf5242
Show file tree
Hide file tree
Showing 44 changed files with 2,455 additions and 130 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Tests

on: [push]

jobs:
test:
name: Pytest
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install torch torchvision
- name: Test with pytest
run: |
pip install pytest
cd tests
python -m pytest --junitxml=junit/test-results.xml
3 changes: 3 additions & 0 deletions docs/_static/css/additional.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
#streetlevel\.streetview\.panorama\.ArtworkLink + dd > dl:first-of-type.field-list {
display:none !important;
}
#streetlevel\.streetview\.panorama\.StreetLabel + dd > dl:first-of-type.field-list {
display:none !important;
}


#streetlevel\.streetside\.panorama\.StreetsidePanorama + dd > dl:first-of-type.field-list {
Expand Down
5 changes: 1 addition & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
project = 'streetlevel'
copyright = '2024, skzk'
author = 'skzk'
release = '0.7.1'
release = '0.8.0'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand All @@ -19,16 +19,13 @@
templates_path = ['_templates']
exclude_patterns = []



# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
html_style = 'css/additional.css'


autodoc_typehints = "description"
add_module_names = False

Expand Down
64 changes: 64 additions & 0 deletions docs/streetlevel.ja.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,77 @@ streetlevel.ja: Já 360
Finding panoramas
-----------------
.. autofunction:: streetlevel.ja.find_panorama

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)
.. autofunction:: streetlevel.ja.find_panorama_async

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)
.. autofunction:: streetlevel.ja.find_panorama_by_id

Usage sample::
from streetlevel import ja
pano = ja.find_panorama_by_id(2962469)
print(pano.lat, pano.lon)
print(pano.date)
print(pano.address)
.. autofunction:: streetlevel.ja.find_panorama_by_id_async

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
---------------------
.. autofunction:: streetlevel.ja.get_panorama
.. autofunction:: streetlevel.ja.get_panorama_async
.. autofunction:: streetlevel.ja.download_panorama

Usage sample::
from streetlevel import ja
pano = ja.find_panorama_by_id(2962469)
ja.download_panorama(pano, f"{pano.id}.jpg")
.. autofunction:: streetlevel.ja.download_panorama_async

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
----------------------
Expand All @@ -24,3 +84,7 @@ Data classes
:members:
.. autoclass:: streetlevel.ja.panorama.JaPanorama
:members:

Miscellaneous
-------------
.. autofunction:: streetlevel.ja.build_permalink
65 changes: 65 additions & 0 deletions docs/streetlevel.kakao.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,77 @@ streetlevel.kakao: Kakao Road View
Finding panoramas
-----------------
.. autofunction:: streetlevel.kakao.find_panoramas

Usage sample::
from streetlevel 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)
.. autofunction:: streetlevel.kakao.find_panoramas_async

Usage sample::
from streetlevel 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)
.. autofunction:: streetlevel.kakao.find_panorama_by_id

Usage sample::
from streetlevel import kakao
pano = kakao.find_panorama_by_id(1168949345)
print(pano.lat, pano.lon)
print(pano.date)
print(pano.address)
.. autofunction:: streetlevel.kakao.find_panorama_by_id_async

Usage sample::
from streetlevel 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
---------------------
.. autofunction:: streetlevel.kakao.get_panorama
.. autofunction:: streetlevel.kakao.get_panorama_async
.. autofunction:: streetlevel.kakao.download_panorama

Usage sample::
from streetlevel import kakao

pano = kakao.find_panorama_by_id(1168949345)
kakao.download_panorama(pano, f"{pano.id}.jpg")
.. autofunction:: streetlevel.kakao.download_panorama_async

Usage sample::
from streetlevel 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")
.. autofunction:: streetlevel.kakao.get_depthmap
.. autofunction:: streetlevel.kakao.get_depthmap_async
.. autofunction:: streetlevel.kakao.download_depthmap
Expand All @@ -26,3 +87,7 @@ Data classes and enums
.. autoclass:: streetlevel.kakao.panorama.PanoramaType
:members:
:member-order: bysource

Miscellaneous
-------------
.. autofunction:: streetlevel.kakao.build_permalink
28 changes: 16 additions & 12 deletions docs/streetlevel.lookaround.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ Support for Apple Look Around.

Note that, unlike with the other providers, this library does not automatically stitch the panoramas
since 1) Look Around does not serve one image broken up into tiles, but six faces which form a
sort-of-but-not-really cubemap, and 2) its image format is somewhat inconvenient to work with.
sort-of-but-not-really cubemap, and 2) its image format, HEIC, is somewhat inconvenient to work with.
A function to create an equirectangular image out of the panorama faces is available, but not exactly fast,
so it is recommended to display the faces unmodified.

Panoramas can be rendered by creating a spherical rectangle (meaning a rectangle on the surface of a sphere) for each face, centered on
phi=0, theta=0. ``fov_s`` is the phi size (width), ``fov_h`` is the theta size (height), and ``cy`` is an additional offset
which must be subtracted from phi. The resulting geometry for the face is then rotated by the given Euler angles. (The API
returns several other parameters, but they do not appear to be in use.)
which must be subtracted from phi. The resulting geometry for the face is then rotated by the specified Euler angles. (The API
returns several other parameters as well, but they do not appear to be in use.)

Finding panoramas
-----------------
Expand Down Expand Up @@ -60,8 +60,8 @@ Downloading panoramas
auth = lookaround.Authenticator()
faces = []
zoom = 0
for faceIdx in range(0, 6):
face = lookaround.get_panorama_face(panos[0], faceIdx, zoom, auth)
for face_idx in range(0, 6):
face = lookaround.get_panorama_face(panos[0], face_idx, zoom, auth)
faces.append(face)
.. autofunction:: streetlevel.lookaround.download_panorama_face
Expand All @@ -74,9 +74,9 @@ Downloading panoramas
auth = lookaround.Authenticator()
zoom = 0
for face in range(0, 6):
lookaround.download_panorama_face(panos[0], f"{panos[0].id}_{face}_{zoom}.heic",
face, zoom, auth)
for face_idx in range(0, 6):
lookaround.download_panorama_face(panos[0], f"{panos[0].id}_{face_idx}_{zoom}.heic",
face_idx, zoom, auth)

Data classes and Enums
----------------------
Expand Down Expand Up @@ -112,11 +112,11 @@ Reprojection
auth = lookaround.Authenticator()
faces = []
zoom = 2
for faceIdx in range(0, 6):
face_heic = lookaround.get_panorama_face(pano, faceIdx, zoom, auth)
for face_idx in range(0, 6):
face_heic = lookaround.get_panorama_face(pano, face_idx, zoom, auth)
# Convert the HEIC file to a PIL image here.
# This step is left to the user of the library, so that you can
# choose whichever library performs best on your machine.
# This step is left to the user so that you can choose whichever
# library performs best on your machine.
faces.append(face)
result = lookaround.to_equirectangular(faces, pano.camera_metadata)
Expand All @@ -126,3 +126,7 @@ Authentication
--------------
.. autoclass:: streetlevel.lookaround.auth.Authenticator
:members:

Miscellaneous
-------------
.. autofunction:: streetlevel.lookaround.build_permalink
66 changes: 65 additions & 1 deletion docs/streetlevel.mapy.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,56 @@
streetlevel.mapy: Mapy.cz Panorama
=======================================


Finding panoramas
-----------------
.. autofunction:: streetlevel.mapy.find_panorama

Usage sample::
from streetlevel import mapy
pano = mapy.find_panorama(50.704732, 14.404809)
print(pano.lat, pano.lon)
print(pano.id)
print(pano.date)

.. autofunction:: streetlevel.mapy.find_panorama_async

Usage sample::
from streetlevel import mapy
from aiohttp import ClientSession
async with ClientSession() as session:
pano = await mapy.find_panorama_async(50.704732, 14.404809, session)
print(pano.lat, pano.lon)
print(pano.id)
print(pano.date)
.. autofunction:: streetlevel.mapy.find_panorama_by_id

Usage sample::
from streetlevel import mapy
pano = mapy.find_panorama_by_id(82102772)
print(pano.lat, pano.lon)
print(pano.date)
print(pano.heading)

.. autofunction:: streetlevel.mapy.find_panorama_by_id_async

Usage sample::
from streetlevel import mapy
from aiohttp import ClientSession
async with ClientSession() as session:
pano = await mapy.find_panorama_by_id_async(82102772, session)
print(pano.lat, pano.lon)
print(pano.date)
print(pano.heading)
.. autofunction:: streetlevel.mapy.get_links
.. autofunction:: streetlevel.mapy.get_links_async

Expand All @@ -16,9 +59,30 @@ Downloading panoramas
.. autofunction:: streetlevel.mapy.get_panorama
.. autofunction:: streetlevel.mapy.get_panorama_async
.. autofunction:: streetlevel.mapy.download_panorama

Usage sample::
from streetlevel import mapy
pano = mapy.find_panorama_by_id(82102772)
mapy.download_panorama(pano, f"{pano.id}.jpg")
.. autofunction:: streetlevel.mapy.download_panorama_async

Usage sample::
from streetlevel import mapy
from aiohttp import ClientSession
async with ClientSession() as session:
pano = await mapy.find_panorama_by_id_async(82102772, session)
await mapy.download_panorama_async(pano, f"{pano.id}.jpg", session)

Data classes
------------
.. autoclass:: streetlevel.mapy.panorama.MapyPanorama
:members:

Miscellaneous
-------------
.. autofunction:: streetlevel.mapy.build_permalink
Loading

0 comments on commit fdf5242

Please sign in to comment.