Py.Cafe

adamschroeder.m/

dash-harlem-street-tour

Interactive Harlem Street Tour

DocsPricing
  • app.py
  • requirements.txt
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import dash
from dash import html, dcc, Input, Output
import dash_pannellum

app = dash.Dash(__name__)
server = app.server
server.config['MAX_CONTENT_LENGTH'] = 100 * 1024 * 1024  # 100 MB

tour_config = {
    "default": {
        "firstScene": "street A",
        "sceneFadeDuration": 1000,
    },
    "scenes": {
        "street A": {
            "title": "Street A",
            "hfov": 100,
            "pitch": -1,
            "yaw": 0,
            "type": "equirectangular",
            "panorama": "https://i.ibb.co/HYHwdQj/street-A.jpg",
            "autoLoad": True,  # Add this line to each scene
            "hotSpots": [
                {
                    "pitch": -2.1,
                    "yaw": 2,
                    "type": "scene",
                    "text": "Between street A & B",
                    "sceneId": "street A-B"
                }
            ]
        },
        "street A-B": {
            "title": "Between street A & B",
            "hfov": 100,
            "yaw": 0,
            "type": "equirectangular",
            "panorama": "https://i.ibb.co/jzGs5SQ/street-AB.jpg",
            "autoLoad": True,  # Add this line to each scene
            "hotSpots": [
                {
                    "pitch": 0,
                    "yaw": -1,
                    "type": "scene",
                    "text": "Street B",
                    "sceneId": "street B",
                    "targetPitch": 0,
                    "targetYaw": 0,
                },
                {
                    "pitch": 180,
                    "yaw": -1,
                    "type": "scene",
                    "text": "Street A",
                    "sceneId": "street A",
                    "targetYaw": 180,
                    "targetPitch": 0,
                }
            ]
        },
        "street B": {
            "title": "Street B",
            "hfov": 100,
            "yaw": 0,
            "type": "equirectangular",
            "panorama": "https://i.ibb.co/Zd7tLhX/street-B.jpg",
            "autoLoad": True,  # Add this line to each scene
            "hotSpots": [
                {
                    "pitch": 0,
                    "yaw": 180,
                    "type": "scene",
                    "text": "Between street A & B",
                    "sceneId": "street A-B",
                    "targetYaw": 180,
                    "targetPitch": 0
                }
            ]
        }
    }
}



app.layout = html.Div([
    html.H1("Harlem Tour Example"),
    dash_pannellum.DashPannellum(
        id='tour-component',
        tour=tour_config,
        customControls=True,
        showCenterDot=False,
        width='100%',
        height='750px',
        autoLoad=True,
        compass=True,
        northOffset=90
    ),
])