offlinestreetview 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- offlinestreetview-0.1.0/LICENSE +21 -0
- offlinestreetview-0.1.0/MANIFEST.in +4 -0
- offlinestreetview-0.1.0/PKG-INFO +65 -0
- offlinestreetview-0.1.0/README.md +31 -0
- offlinestreetview-0.1.0/pyproject.toml +58 -0
- offlinestreetview-0.1.0/setup.cfg +4 -0
- offlinestreetview-0.1.0/src/offlinestreetview/__init__.py +4 -0
- offlinestreetview-0.1.0/src/offlinestreetview/__main__.py +4 -0
- offlinestreetview-0.1.0/src/offlinestreetview/app.py +275 -0
- offlinestreetview-0.1.0/src/offlinestreetview/callbacks.py +364 -0
- offlinestreetview-0.1.0/src/offlinestreetview/config.py +74 -0
- offlinestreetview-0.1.0/src/offlinestreetview/plots.py +183 -0
- offlinestreetview-0.1.0/src/offlinestreetview/tiles.py +102 -0
- offlinestreetview-0.1.0/src/offlinestreetview/utils.py +148 -0
- offlinestreetview-0.1.0/src/offlinestreetview.egg-info/PKG-INFO +65 -0
- offlinestreetview-0.1.0/src/offlinestreetview.egg-info/SOURCES.txt +19 -0
- offlinestreetview-0.1.0/src/offlinestreetview.egg-info/dependency_links.txt +1 -0
- offlinestreetview-0.1.0/src/offlinestreetview.egg-info/entry_points.txt +3 -0
- offlinestreetview-0.1.0/src/offlinestreetview.egg-info/requires.txt +10 -0
- offlinestreetview-0.1.0/src/offlinestreetview.egg-info/top_level.txt +1 -0
- offlinestreetview-0.1.0/tests/test_smoke.py +35 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kuldeep Dixit
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: offlinestreetview
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Offline street-level image dashboard: synced images, OpenStreetMap tiles, bar chart and image-shift export.
|
|
5
|
+
Author-email: Kuldeep Dixit <dixitkuldeep252@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Kuldeep252/offlinestreetview
|
|
8
|
+
Project-URL: Source, https://github.com/Kuldeep252/offlinestreetview
|
|
9
|
+
Project-URL: Issues, https://github.com/Kuldeep252/offlinestreetview/issues
|
|
10
|
+
Keywords: dash,plotly,openstreetmap,offline,dashboard,image,street-view
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Framework :: Dash
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: dash>=2.11
|
|
25
|
+
Requires-Dist: plotly<6
|
|
26
|
+
Requires-Dist: pandas>=1.3
|
|
27
|
+
Requires-Dist: numpy>=1.20
|
|
28
|
+
Requires-Dist: Flask>=2.0
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
31
|
+
Requires-Dist: twine>=4.0; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# Offline Street View
|
|
36
|
+
|
|
37
|
+
Modular Dash dashboard for street-level surveys: two synced images, an
|
|
38
|
+
OpenStreetMap map (online **or** fully offline tiles), a bar chart of any
|
|
39
|
+
numeric CSV column, image-shift controls and a shifted-CSV export.
|
|
40
|
+
|
|
41
|
+
## Install
|
|
42
|
+
pip install offlinestreetview
|
|
43
|
+
|
|
44
|
+
## Run
|
|
45
|
+
python -m offlinestreetview ## http://127.0.0.1:8050
|
|
46
|
+
python offlinestreetview --port 8070 --debug
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
Options: `--host`, `--port`, `--debug`, `--tile-dir`.
|
|
50
|
+
|
|
51
|
+
## Offline map tiles
|
|
52
|
+
Enable "Use offline tiles" on the setup screen, or pre-download:
|
|
53
|
+
|
|
54
|
+
offlinestreetview-tiles --lat-min 38.89 --lat-max 38.95 \
|
|
55
|
+
--lon-min -77.06 --lon-max -77.00 --zoom 18
|
|
56
|
+
|
|
57
|
+
Tiles are stored in:
|
|
58
|
+
* `%LOCALAPPDATA%\offlinestreetview\osm_tiles` (Windows)
|
|
59
|
+
* `~/.local/share/offlinestreetview/osm_tiles` (Linux/macOS)
|
|
60
|
+
|
|
61
|
+
Override with the `OFFLINESTREETVIEW_HOME` environment variable, or `--tile-dir`.
|
|
62
|
+
|
|
63
|
+
## Expected CSV columns
|
|
64
|
+
`adj_time`, `lat`, `lon`, `path_fr`, `file_fr`, `path_bk`, `file_bk`
|
|
65
|
+
+ the numeric columns can be edited on the setup screen.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Offline Street View
|
|
2
|
+
|
|
3
|
+
Modular Dash dashboard for street-level surveys: two synced images, an
|
|
4
|
+
OpenStreetMap map (online **or** fully offline tiles), a bar chart of any
|
|
5
|
+
numeric CSV column, image-shift controls and a shifted-CSV export.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
pip install offlinestreetview
|
|
9
|
+
|
|
10
|
+
## Run
|
|
11
|
+
python -m offlinestreetview ## http://127.0.0.1:8050
|
|
12
|
+
python offlinestreetview --port 8070 --debug
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
Options: `--host`, `--port`, `--debug`, `--tile-dir`.
|
|
16
|
+
|
|
17
|
+
## Offline map tiles
|
|
18
|
+
Enable "Use offline tiles" on the setup screen, or pre-download:
|
|
19
|
+
|
|
20
|
+
offlinestreetview-tiles --lat-min 38.89 --lat-max 38.95 \
|
|
21
|
+
--lon-min -77.06 --lon-max -77.00 --zoom 18
|
|
22
|
+
|
|
23
|
+
Tiles are stored in:
|
|
24
|
+
* `%LOCALAPPDATA%\offlinestreetview\osm_tiles` (Windows)
|
|
25
|
+
* `~/.local/share/offlinestreetview/osm_tiles` (Linux/macOS)
|
|
26
|
+
|
|
27
|
+
Override with the `OFFLINESTREETVIEW_HOME` environment variable, or `--tile-dir`.
|
|
28
|
+
|
|
29
|
+
## Expected CSV columns
|
|
30
|
+
`adj_time`, `lat`, `lon`, `path_fr`, `file_fr`, `path_bk`, `file_bk`
|
|
31
|
+
+ the numeric columns can be edited on the setup screen.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "offlinestreetview"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Offline street-level image dashboard: synced images, OpenStreetMap tiles, bar chart and image-shift export."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{ name = "Kuldeep Dixit", email = "dixitkuldeep252@gmail.com" }]
|
|
14
|
+
keywords = ["dash", "plotly", "openstreetmap", "offline", "dashboard", "image", "street-view"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 4 - Beta",
|
|
17
|
+
"Framework :: Dash",
|
|
18
|
+
"Intended Audience :: Science/Research",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.9",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Topic :: Scientific/Engineering :: Visualization",
|
|
26
|
+
]
|
|
27
|
+
dependencies = [
|
|
28
|
+
"dash>=2.11",
|
|
29
|
+
"plotly<6",
|
|
30
|
+
"pandas>=1.3",
|
|
31
|
+
"numpy>=1.20",
|
|
32
|
+
"Flask>=2.0",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.optional-dependencies]
|
|
36
|
+
dev = ["build>=1.0", "twine>=4.0", "pytest>=7.0"]
|
|
37
|
+
|
|
38
|
+
[project.urls]
|
|
39
|
+
Homepage = "https://github.com/Kuldeep252/offlinestreetview"
|
|
40
|
+
Source = "https://github.com/Kuldeep252/offlinestreetview"
|
|
41
|
+
Issues = "https://github.com/Kuldeep252/offlinestreetview/issues"
|
|
42
|
+
|
|
43
|
+
[project.scripts]
|
|
44
|
+
offlinestreetview = "offlinestreetview.app:main"
|
|
45
|
+
offlinestreetview-tiles = "offlinestreetview.tiles:cli"
|
|
46
|
+
|
|
47
|
+
[tool.setuptools]
|
|
48
|
+
package-dir = { "" = "src" }
|
|
49
|
+
include-package-data = true
|
|
50
|
+
|
|
51
|
+
[tool.setuptools.packages.find]
|
|
52
|
+
where = ["src"]
|
|
53
|
+
|
|
54
|
+
[tool.setuptools.dynamic]
|
|
55
|
+
version = { attr = "offlinestreetview.config.__version__" }
|
|
56
|
+
|
|
57
|
+
[tool.pytest.ini_options]
|
|
58
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
"""app.py - MAIN entry point of the Offline Street View dashboard.
|
|
2
|
+
|
|
3
|
+
Builds the layout, registers the callbacks and starts the server.
|
|
4
|
+
All heavy lifting is imported from utils.py / tiles.py / plots.py / callbacks.py.
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import argparse
|
|
9
|
+
import pathlib
|
|
10
|
+
|
|
11
|
+
import dash
|
|
12
|
+
from dash import dcc, html
|
|
13
|
+
|
|
14
|
+
from .callbacks import register_callbacks
|
|
15
|
+
from .config import (APP_NAME, DEFAULT_BAR_COLS, DEFAULT_BAR_HEIGHT_VH,
|
|
16
|
+
DEFAULT_CSV_NAME, DEFAULT_CSV_PATH, DEFAULT_IMG_HEIGHT_VH,
|
|
17
|
+
DEFAULT_IMG_WIDTH_PCT, DEFAULT_MAP_OPACITY,
|
|
18
|
+
DEFAULT_PANEL_PCT, DEFAULT_TILE_DIR, DEFAULT_TILE_ZOOM,
|
|
19
|
+
DEFAULT_X_OFFSET_PX, DEFAULT_Y_OFFSET_PX)
|
|
20
|
+
from .tiles import register_tile_server
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# --------------------------------------------------------------------------- #
|
|
24
|
+
# LAYOUT
|
|
25
|
+
# --------------------------------------------------------------------------- #
|
|
26
|
+
def _config_screen():
|
|
27
|
+
"""First screen: ask for data source, numeric columns and image size."""
|
|
28
|
+
return html.Div(id="config-screen", children=[
|
|
29
|
+
html.Div(style={"maxWidth": "900px", "margin": "0 auto",
|
|
30
|
+
"padding": "20px", "border": "1px solid #ddd",
|
|
31
|
+
"borderRadius": "8px", "backgroundColor": "#fafafa"},
|
|
32
|
+
children=[
|
|
33
|
+
html.H2(f"{APP_NAME} - Setup", style={"textAlign": "center"}),
|
|
34
|
+
|
|
35
|
+
html.H3("1) Data source"),
|
|
36
|
+
html.Label("CSV folder:"),
|
|
37
|
+
dcc.Input(id="cfg-csv-path", type="text", value=DEFAULT_CSV_PATH,
|
|
38
|
+
placeholder="e.g. /data/my_survey/",
|
|
39
|
+
style={"width": "100%", "marginBottom": "10px"}),
|
|
40
|
+
html.Label("CSV filename:"),
|
|
41
|
+
dcc.Input(id="cfg-csv-name", type="text", value=DEFAULT_CSV_NAME,
|
|
42
|
+
placeholder="e.g. 20211203.csv",
|
|
43
|
+
style={"width": "40%", "marginBottom": "10px"}),
|
|
44
|
+
|
|
45
|
+
html.H3("2) Numeric columns for the bar plot (load ONLY these)"),
|
|
46
|
+
html.Label("Comma-separated column names:"),
|
|
47
|
+
dcc.Input(id="cfg-bar-cols", type="text",
|
|
48
|
+
value=", ".join(DEFAULT_BAR_COLS),
|
|
49
|
+
style={"width": "100%", "marginBottom": "10px"}),
|
|
50
|
+
html.Div(id="cfg-error", style={"color": "red", "fontWeight": "bold"}),
|
|
51
|
+
|
|
52
|
+
html.H3("3) Image frame - position & size (applied before loading)"),
|
|
53
|
+
html.Label("Images panel width (% of screen):"),
|
|
54
|
+
dcc.Slider(id="cfg-panel-pct", min=15, max=70, step=5, value=DEFAULT_PANEL_PCT,
|
|
55
|
+
marks={15: "15%", 40: "40%", 70: "70%"}),
|
|
56
|
+
html.Label(f"Image width inside its frame (%): default {DEFAULT_IMG_WIDTH_PCT}%"),
|
|
57
|
+
dcc.Slider(id="cfg-img-width-pct", min=10, max=100, step=5,
|
|
58
|
+
value=DEFAULT_IMG_WIDTH_PCT,
|
|
59
|
+
marks={10: "10%", 50: "50%", 100: "100%"}),
|
|
60
|
+
html.Label(f"Image height (vh): default {DEFAULT_IMG_HEIGHT_VH}vh"),
|
|
61
|
+
dcc.Slider(id="cfg-img-height-vh", min=5, max=90, step=5,
|
|
62
|
+
value=DEFAULT_IMG_HEIGHT_VH,
|
|
63
|
+
marks={5: "5", 45: "45", 90: "90"}),
|
|
64
|
+
html.Div([
|
|
65
|
+
html.Div([
|
|
66
|
+
html.Label("X offset (px):", style={"fontWeight": "bold"}),
|
|
67
|
+
dcc.Input(id="cfg-img-x-offset", type="number", value=DEFAULT_X_OFFSET_PX,
|
|
68
|
+
style={"width": "90px", "marginLeft": "8px"}),
|
|
69
|
+
], style={"display": "inline-block", "marginRight": "40px"}),
|
|
70
|
+
html.Div([
|
|
71
|
+
html.Label("Y offset (px):", style={"fontWeight": "bold"}),
|
|
72
|
+
dcc.Input(id="cfg-img-y-offset", type="number", value=DEFAULT_Y_OFFSET_PX,
|
|
73
|
+
style={"width": "90px", "marginLeft": "8px"}),
|
|
74
|
+
], style={"display": "inline-block"}),
|
|
75
|
+
], style={"margin": "10px 0"}),
|
|
76
|
+
|
|
77
|
+
# ---- CHANGE 4: bar plot WIDTH slider removed, only HEIGHT kept ----
|
|
78
|
+
html.H3("4) Bar plot height"),
|
|
79
|
+
html.Label(f"Bar plot height (vh): default {DEFAULT_BAR_HEIGHT_VH}vh"),
|
|
80
|
+
dcc.Slider(id="cfg-bar-height-vh", min=10, max=60, step=5,
|
|
81
|
+
value=DEFAULT_BAR_HEIGHT_VH,
|
|
82
|
+
marks={10: "10", 25: "25", 60: "60"}),
|
|
83
|
+
|
|
84
|
+
html.H3("5) Offline OpenStreetMap tiles (optional)"),
|
|
85
|
+
dcc.Checklist(
|
|
86
|
+
id="cfg-offline",
|
|
87
|
+
options=[{"label": " Use offline tiles (works without internet)",
|
|
88
|
+
"value": "on"}],
|
|
89
|
+
value=[],
|
|
90
|
+
style={"marginBottom": "10px"},
|
|
91
|
+
),
|
|
92
|
+
html.Label("Tile zoom level (higher = more detail, more tiles):"),
|
|
93
|
+
dcc.Slider(id="cfg-tile-zoom", min=10, max=19, step=1, value=DEFAULT_TILE_ZOOM,
|
|
94
|
+
marks={10: "10", 14: "14", 18: "18", 19: "19"}),
|
|
95
|
+
|
|
96
|
+
html.Button("Load dashboard", id="cfg-load-btn", n_clicks=0,
|
|
97
|
+
style={"marginTop": "20px", "padding": "10px 30px",
|
|
98
|
+
"fontSize": "16px", "backgroundColor": "#007BFF",
|
|
99
|
+
"color": "white", "border": "none",
|
|
100
|
+
"borderRadius": "4px"}),
|
|
101
|
+
]),
|
|
102
|
+
])
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def _dashboard_screen():
|
|
106
|
+
"""Second screen: the viewer (row selector, map, bar chart, images, shifts)."""
|
|
107
|
+
return html.Div(id="dashboard-screen", style={"display": "none"}, children=[
|
|
108
|
+
|
|
109
|
+
# -------- header with "Change Settings" button ---------------------
|
|
110
|
+
html.Div(
|
|
111
|
+
html.Button(
|
|
112
|
+
"⚙️ Change Settings",
|
|
113
|
+
id="back-to-config-btn",
|
|
114
|
+
n_clicks=0,
|
|
115
|
+
style={"backgroundColor": "#6C757D", "color": "white",
|
|
116
|
+
"border": "none", "padding": "6px 16px",
|
|
117
|
+
"borderRadius": "4px"},
|
|
118
|
+
),
|
|
119
|
+
style={"textAlign": "right", "padding": "5px 20px"},
|
|
120
|
+
),
|
|
121
|
+
|
|
122
|
+
# ================= CHANGE 5: row / timestamp selector on TOP =======
|
|
123
|
+
html.Div([
|
|
124
|
+
dcc.Slider(
|
|
125
|
+
id="image-slider",
|
|
126
|
+
min=0, max=0, step=1, value=0,
|
|
127
|
+
marks={}, # <-- no tick labels any more
|
|
128
|
+
tooltip={"placement": "bottom"},
|
|
129
|
+
),
|
|
130
|
+
html.Div(
|
|
131
|
+
id="bar-subheading",
|
|
132
|
+
style={"textAlign": "center", "fontWeight": "bold",
|
|
133
|
+
"fontSize": "16px", "margin": "10px 0 4px 0"},
|
|
134
|
+
),
|
|
135
|
+
], style={"width": "95%", "margin": "5px auto 10px auto"}),
|
|
136
|
+
|
|
137
|
+
# -------- middle: map + bar plot (left), images (right) -----------
|
|
138
|
+
html.Div(style={"width": "100%", "display": "flex"}, children=[
|
|
139
|
+
html.Div(id="plots-column", style={"width": "60%", "float": "left"},
|
|
140
|
+
children=[
|
|
141
|
+
|
|
142
|
+
# ============ CHANGE 3: map transparency ABOVE the map ====
|
|
143
|
+
html.Div([
|
|
144
|
+
html.Label("Map transparency (0 = transparent, 1 = opaque):",
|
|
145
|
+
style={"fontWeight": "bold", "display": "block",
|
|
146
|
+
"marginBottom": "0"}),
|
|
147
|
+
dcc.Slider(
|
|
148
|
+
id="map-opacity-slider",
|
|
149
|
+
min=0, max=1, step=0.05,
|
|
150
|
+
value=DEFAULT_MAP_OPACITY,
|
|
151
|
+
marks={0: "Transparent", 0.5: "Semi", 1: "Opaque"},
|
|
152
|
+
),
|
|
153
|
+
], style={"width": "100%", "textAlign": "center",
|
|
154
|
+
"margin": "0 0 8px 0"}),
|
|
155
|
+
|
|
156
|
+
dcc.Graph(id="map", style={"width": "100%", "height": "50vh"}),
|
|
157
|
+
|
|
158
|
+
# ============ CHANGE 2: "Bubble color column" dropdown removed
|
|
159
|
+
html.Div([
|
|
160
|
+
dcc.Checklist(
|
|
161
|
+
id="show-all-points",
|
|
162
|
+
options=[{"label": " Show all data points (bubble / heatmap)",
|
|
163
|
+
"value": "on"}],
|
|
164
|
+
value=[],
|
|
165
|
+
style={"display": "inline-block"},
|
|
166
|
+
),
|
|
167
|
+
], style={"textAlign": "center", "margin": "5px", "width": "100%"}),
|
|
168
|
+
|
|
169
|
+
dcc.Dropdown(id="bar-dropdown", clearable=False,
|
|
170
|
+
placeholder="Select a numeric column"),
|
|
171
|
+
dcc.Graph(id="bar-plot", style={"width": "100%", "height": "25vh"}),
|
|
172
|
+
]),
|
|
173
|
+
html.Div(id="images-column", style={"width": "40%"}, children=[
|
|
174
|
+
html.Img(id="image1"),
|
|
175
|
+
html.Img(id="image2"),
|
|
176
|
+
]),
|
|
177
|
+
]),
|
|
178
|
+
|
|
179
|
+
# -------- shift controls -----------------------------------------
|
|
180
|
+
html.Div([
|
|
181
|
+
html.H4("Image Shift Controls", style={"textAlign": "center",
|
|
182
|
+
"marginTop": "20px"}),
|
|
183
|
+
html.Div([
|
|
184
|
+
html.Div([
|
|
185
|
+
html.Label("Image 1 Shift:", style={"fontWeight": "bold"}),
|
|
186
|
+
dcc.Input(id="image1-shift-input", type="number", value=0, step=1,
|
|
187
|
+
style={"width": "80px", "marginLeft": "10px"}),
|
|
188
|
+
html.Button("Apply Shift 1", id="apply-shift1-btn", n_clicks=0,
|
|
189
|
+
style={"marginLeft": "10px", "backgroundColor": "#007BFF",
|
|
190
|
+
"color": "white", "border": "none",
|
|
191
|
+
"padding": "5px 10px", "borderRadius": "3px"}),
|
|
192
|
+
], style={"display": "inline-block", "marginRight": "30px"}),
|
|
193
|
+
html.Div([
|
|
194
|
+
html.Label("Image 2 Shift:", style={"fontWeight": "bold"}),
|
|
195
|
+
dcc.Input(id="image2-shift-input", type="number", value=0, step=1,
|
|
196
|
+
style={"width": "80px", "marginLeft": "10px"}),
|
|
197
|
+
html.Button("Apply Shift 2", id="apply-shift2-btn", n_clicks=0,
|
|
198
|
+
style={"marginLeft": "10px", "backgroundColor": "#28A745",
|
|
199
|
+
"color": "white", "border": "none",
|
|
200
|
+
"padding": "5px 10px", "borderRadius": "3px"}),
|
|
201
|
+
], style={"display": "inline-block", "marginRight": "30px"}),
|
|
202
|
+
html.Div([
|
|
203
|
+
html.Button("Reset Shifts", id="reset-shifts-btn", n_clicks=0,
|
|
204
|
+
style={"backgroundColor": "#FFC107", "color": "black",
|
|
205
|
+
"border": "none", "padding": "5px 15px",
|
|
206
|
+
"borderRadius": "3px"}),
|
|
207
|
+
], style={"display": "inline-block", "marginRight": "30px"}),
|
|
208
|
+
html.Div([
|
|
209
|
+
html.Button("Export Changes", id="export-btn", n_clicks=0,
|
|
210
|
+
style={"backgroundColor": "#DC3545", "color": "white",
|
|
211
|
+
"border": "none", "padding": "5px 15px",
|
|
212
|
+
"borderRadius": "3px"}),
|
|
213
|
+
], style={"display": "inline-block"}),
|
|
214
|
+
html.Div([
|
|
215
|
+
html.Button("Download OSM Tiles (offline)", id="download-tiles-btn",
|
|
216
|
+
n_clicks=0,
|
|
217
|
+
style={"backgroundColor": "#6F42C1", "color": "white",
|
|
218
|
+
"border": "none", "padding": "5px 15px",
|
|
219
|
+
"borderRadius": "3px"}),
|
|
220
|
+
], style={"display": "inline-block", "marginLeft": "30px"}),
|
|
221
|
+
], style={"textAlign": "center", "margin": "10px"}),
|
|
222
|
+
|
|
223
|
+
html.Div(id="shift-status", style={"textAlign": "center", "margin": "6px",
|
|
224
|
+
"fontWeight": "bold"}),
|
|
225
|
+
html.Div(id="export-status", style={"textAlign": "center", "margin": "6px",
|
|
226
|
+
"fontWeight": "bold"}),
|
|
227
|
+
html.Div(id="tile-status", style={"textAlign": "center", "margin": "6px",
|
|
228
|
+
"fontWeight": "bold", "color": "#6F42C1"}),
|
|
229
|
+
]),
|
|
230
|
+
|
|
231
|
+
# -------- hidden stores -------------------------------------------
|
|
232
|
+
dcc.Store(id="data-store"),
|
|
233
|
+
dcc.Store(id="config-store"),
|
|
234
|
+
dcc.Store(id="shift-store", data={"image1_shift": 0, "image2_shift": 0}),
|
|
235
|
+
])
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
def make_layout():
|
|
239
|
+
return html.Div([
|
|
240
|
+
html.H1(APP_NAME, style={"textAlign": "center"}),
|
|
241
|
+
_config_screen(),
|
|
242
|
+
_dashboard_screen(),
|
|
243
|
+
])
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
# --------------------------------------------------------------------------- #
|
|
247
|
+
# MAIN
|
|
248
|
+
# --------------------------------------------------------------------------- #
|
|
249
|
+
def main(argv=None):
|
|
250
|
+
parser = argparse.ArgumentParser(prog="offlinestreetview",
|
|
251
|
+
description=f"{APP_NAME} dashboard")
|
|
252
|
+
parser.add_argument("--host", default="127.0.0.1", help="host to bind")
|
|
253
|
+
parser.add_argument("--port", default=8050, type=int, help="port to bind")
|
|
254
|
+
parser.add_argument("--debug", action="store_true", help="run in debug mode")
|
|
255
|
+
parser.add_argument("--tile-dir", default=None,
|
|
256
|
+
help="folder for offline OSM tiles (default: user data dir)")
|
|
257
|
+
args = parser.parse_args(argv)
|
|
258
|
+
|
|
259
|
+
tile_dir = pathlib.Path(args.tile_dir).expanduser() if args.tile_dir else DEFAULT_TILE_DIR
|
|
260
|
+
|
|
261
|
+
app = dash.Dash(__name__, title=APP_NAME)
|
|
262
|
+
|
|
263
|
+
register_tile_server(app, tile_dir)
|
|
264
|
+
|
|
265
|
+
app.layout = make_layout()
|
|
266
|
+
register_callbacks(app)
|
|
267
|
+
|
|
268
|
+
print(f" * {APP_NAME}: http://{args.host}:{args.port}")
|
|
269
|
+
print(f" * Offline tiles folder: {tile_dir}")
|
|
270
|
+
run = getattr(app, "run", None) or app.run_server # dash >= 2.17 renamed it
|
|
271
|
+
run(host=args.host, port=args.port, debug=args.debug, use_reloader=False)
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
if __name__ == "__main__":
|
|
275
|
+
main()
|