Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions PRIVACY_POLICY.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,12 @@ OpenSAK does not log, cache on any server, or share any data returned from the G

### 5.1 Map tiles

The in-application map uses OpenStreetMap tiles to display the map background. When you view the map, your device fetches map tile images from OpenStreetMap servers. This is a standard web request and may include your IP address, as with any web browsing. OpenStreetMap's privacy policy is available at:
The in-application map uses OpenStreetMap tiles to display the map background by default. When you view the map, your device fetches map tile images from OpenStreetMap servers. This is a standard web request and may include your IP address, as with any web browsing. OpenStreetMap's privacy policy is available at:
https://wiki.osmfoundation.org/wiki/Privacy_Policy

Map tiles you have viewed are kept in a cache on your own computer (in the OpenSAK data folder, up to the size set in **Settings → Map → Map tile cache**), so areas you viewed recently still show without an internet connection. Only tiles you actually viewed are stored; OpenSAK never downloads map areas in advance. The cache stays on your computer and is not sent anywhere.
Under **Settings → Map → Base maps** you can switch on other base maps. Tiles of a map you switch on and view are fetched in the same way from that map's provider: OpenTopoMap, OpenStreetMap France (CyclOSM, OSM Humanitarian), national mapping agencies (swisstopo, basemap.at, IGN France, PDOK, basemap.de, USGS), or, only if you enter your own API key for them, Esri, MapTiler or Thunderforest. Requests to a provider that needs a key include your key. Each provider's own privacy policy applies. API keys you enter are stored only in the OpenSAK settings file on your computer.

Map tiles you have viewed are kept in a cache on your own computer (in the OpenSAK data folder, up to the size set in **Settings → Map → Map tile cache**), so areas you viewed recently still show without an internet connection. Only tiles you actually viewed are stored, and only for as long as each provider allows; tiles of providers that do not allow storing them (Esri) are never written to disk. OpenSAK never downloads map areas in advance. The cache stays on your computer and is not sent anywhere.

You can optionally configure OpenSAK to open cache locations in Google Maps or OpenStreetMap in your browser. This is triggered only by your explicit action and is subject to those services' own privacy policies.

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ MIT License — see [LICENSE](LICENSE) for details.
## Acknowledgements

- [OpenStreetMap](https://www.openstreetmap.org) for map tiles
- [OpenTopoMap](https://opentopomap.org), [OpenStreetMap France](https://www.openstreetmap.fr) (CyclOSM, OSM Humanitarian), [swisstopo](https://www.swisstopo.admin.ch), [basemap.at](https://basemap.at), [IGN](https://www.ign.fr), [PDOK](https://www.pdok.nl), [basemap.de](https://basemap.de) and the [USGS](https://www.usgs.gov) for the optional base maps
- [Leaflet.js](https://leafletjs.com) for the map library, with
[Leaflet.markercluster](https://github.com/Leaflet/Leaflet.markercluster) and
[Leaflet-Geoman](https://geoman.io) (bundled; see [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md))
Expand Down
88 changes: 88 additions & 0 deletions src/opensak/gui/dialogs/settings_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ def _build_map_tab(self) -> QWidget:
group_layout.addWidget(tile_cache_note)

layout.addWidget(group)
layout.addWidget(self._build_map_layers_group())
layout.addStretch()

# Same fix as General/Advanced (see #811 comment on __init__ for
Expand All @@ -583,6 +584,91 @@ def _build_map_tab(self) -> QWidget:
scroll.setFrameShape(QScrollArea.Shape.NoFrame)
return scroll

def _build_map_layers_group(self) -> QGroupBox:
"""#747: switch each base map on or off, and enter API keys for the
providers that need one (gui/map_layers.py)."""
from opensak.gui.map_layers import KEY_PROVIDERS, LAYERS

group = QGroupBox(tr("settings_group_map_layers"))
group_layout = QVBoxLayout(group)

note = QLabel(tr("settings_map_layers_note"))
note.setWordWrap(True)
note.setStyleSheet(hint_style())
group_layout.addWidget(note)

self._map_layers_list = QListWidget()
# Long entries wrap instead of disappearing behind a sideways scroll
self._map_layers_list.setWordWrap(True)
self._map_layers_list.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
for layer in LAYERS:
text = layer.label
hints = []
if layer.key_provider:
# One key per provider, which may unlock several maps
hints.append(tr("settings_map_layer_needs_key",
provider=KEY_PROVIDERS[layer.key_provider][0]))
if not layer.offline:
hints.append(tr("settings_map_layer_no_offline"))
if hints:
text += " — " + ", ".join(hints)
item = QListWidgetItem(text)
item.setData(Qt.ItemDataRole.UserRole, layer.id)
item.setFlags(item.flags() | Qt.ItemFlag.ItemIsUserCheckable)
item.setCheckState(Qt.CheckState.Unchecked)
self._map_layers_list.addItem(item)
self._map_layers_list.setMinimumHeight(220)
group_layout.addWidget(self._map_layers_list)

group_layout.addWidget(QLabel(tr("settings_map_api_keys_label")))
keys_form = QFormLayout()
self._map_api_key_edits: dict[str, QLineEdit] = {}
for provider_id, (provider_name, signup_url) in KEY_PROVIDERS.items():
maps = ", ".join(layer.provider for layer in LAYERS
if layer.key_provider == provider_id)
edit = QLineEdit()
edit.setPlaceholderText(tr("settings_map_api_key_for", maps=maps))
self._map_api_key_edits[provider_id] = edit
get_key = QLabel(f'<a href="{signup_url}">{tr("settings_map_api_key_get")}</a>')
get_key.setOpenExternalLinks(True)
get_key.setToolTip(signup_url)
row = QHBoxLayout()
row.addWidget(edit, 1)
row.addWidget(get_key)
keys_form.addRow(provider_name + ":", row)
group_layout.addLayout(keys_form)

keys_note = QLabel(tr("settings_map_api_keys_note"))
keys_note.setWordWrap(True)
keys_note.setStyleSheet(hint_style())
group_layout.addWidget(keys_note)
return group

def _load_map_layers(self) -> None:
s = get_settings()
enabled = set(s.map_base_layers)
for row in range(self._map_layers_list.count()):
item = self._map_layers_list.item(row)
if item is None:
continue
on = item.data(Qt.ItemDataRole.UserRole) in enabled
item.setCheckState(Qt.CheckState.Checked if on else Qt.CheckState.Unchecked)
keys = s.map_api_keys
for provider_id, edit in self._map_api_key_edits.items():
edit.setText(keys.get(provider_id, ""))

def _save_map_layers(self) -> None:
s = get_settings()
enabled = []
for row in range(self._map_layers_list.count()):
item = self._map_layers_list.item(row)
if item is not None and item.checkState() == Qt.CheckState.Checked:
enabled.append(item.data(Qt.ItemDataRole.UserRole))
s.map_base_layers = enabled
s.map_api_keys = {
provider_id: edit.text() for provider_id, edit in self._map_api_key_edits.items()
}

# ── Fane: Avanceret ───────────────────────────────────────────────────────

def _build_advanced_tab(self) -> QWidget:
Expand Down Expand Up @@ -1843,6 +1929,7 @@ def _load(self) -> None:
self._map_enabled_cb.setChecked(s.map_enabled)
self._map_max_caches.setValue(s.map_max_caches)
self._map_tile_cache.setValue(s.map_tile_cache_mb)
self._load_map_layers()
idx = self._map_cluster_radius.findData(s.map_cluster_radius)
self._map_cluster_radius.setCurrentIndex(max(idx, 0))
idx = self._map_labels.findData(s.map_labels)
Expand Down Expand Up @@ -1976,6 +2063,7 @@ def _save(self) -> None:
s.map_enabled = self._map_enabled_cb.isChecked()
s.map_max_caches = self._map_max_caches.value()
s.map_tile_cache_mb = self._map_tile_cache.value()
self._save_map_layers()
s.map_cluster_radius = self._map_cluster_radius.currentData()
s.map_labels = self._map_labels.currentData()
separation_val = self._map_separation_radius.value()
Expand Down
Loading
Loading