preparations for offline map based on openfreemap

This commit is contained in:
Matthias Wirth
2025-10-06 14:15:30 +00:00
parent fafe720e17
commit e2003ccd31
3 changed files with 30 additions and 2 deletions

View File

@@ -79,6 +79,7 @@ let openAIPOpacity = 0.70;
let tfrOpacity = 0.70;
let offlineMapDetail = -1;
let offlineMapDetailOFM = -1;
// -- Marker settings -------------------------------------
// (marker == aircraft icon)

View File

@@ -99,6 +99,22 @@ function createBaseLayers() {
type: 'base',
}));
if (offlineMapDetailOFM > 0) {
world.push(new ol.layer.VectorTile({
type: 'base',
name: 'OpenFreeMapOffline',
title: 'OpenFreeMap Offline',
declutter: true,
onVisible: (layer) => {
if (!layer.get('styleApplied')) {
// ol-mapbox-style plugin packed in with ol ... (kinda ugly)
ol.mapboxStyle.applyStyle(layer, "./openfreemap_tiles_offline/liberty");
ol.mapboxStyle.applyBackground(layer, "./openfreemap_tiles_offline/liberty");
layer.set('styleApplied', true);
}
},
}));
}
if (1) {
world.push(new ol.layer.VectorTile({
type: 'base',

View File

@@ -308,16 +308,27 @@ do
# in case we have offlinemaps installed, modify config.js
MAX_OFFLINE=""
MAX_OFFLINE_OFM=""
for i in {0..15}; do
if [[ -d /usr/local/share/openfreemap_offline/mnt/tiles/$i ]]; then
MAX_OFFLINE_OFM=$i
fi
if [[ -d /usr/local/share/osm_tiles_offline/$i ]]; then
MAX_OFFLINE=$i
fi
done
if [[ -n "$MAX_OFFLINE" ]]; then
if ! grep "$TMP/config.js" -e '^offlineMapDetail.*' -qs &>/dev/null; then
if ! grep "$TMP/config.js" -E -e '^offlineMapDetail\s*=.*' -qs; then
echo "offlineMapDetail=$MAX_OFFLINE;" >> "$TMP/config.js"
else
sed -i -e "s/^offlineMapDetail.*/offlineMapDetail=$MAX_OFFLINE;/" "$TMP/config.js"
sed -i -e "s/^offlineMapDetail\s*=.*/offlineMapDetail=$MAX_OFFLINE;/" "$TMP/config.js"
fi
fi
if [[ -n "$MAX_OFFLINE_OFM" ]]; then
if ! grep "$TMP/config.js" -E -e '^offlineMapDetailOFM\s*=.*' -qs; then
echo "offlineMapDetailOFM=$MAX_OFFLINE_OFM;" >> "$TMP/config.js"
else
sed -i -e "s/^offlineMapDetailOFM\s=.*/offlineMapDetailOFM=$MAX_OFFLINE_OFM;/" "$TMP/config.js"
fi
fi