Skip to content

Open Infrastructure Map, a view of infrastructure data in OpenStreetMap

Update maplibre to latest version and remove mapboxgl references

Russ Garrett7aa77636fcdf
diff --git a/web/package-lock.json b/web/package-lock.json
index 9aa1575..bf1328c 100644
--- a/web/package-lock.json
+++ b/web/package-lock.json
@@ -13,7 +13,7 @@
"lodash.invert": "^4.3.0",
"lodash.isequal": "^4.5.0",
"lodash.sortby": "^4.7.0",
- "maplibre-gl": "^1.13.0-rc.5",
+ "maplibre-gl": "^1.15.2",
"redom": "^3.27.1",
"title-case": "^2.1.1"
},
@@ -5288,9 +5288,9 @@
}
},
"node_modules/nth-check": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.0.tgz",
- "integrity": "sha512-i4sc/Kj8htBrAiH1viZ0TgU8Y5XqCaV/FziYK6TBczxmeKm3AEFWqqF3195yKudrarqy7Zu80Ra5dobFjn9X/Q==",
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.1.tgz",
+ "integrity": "sha512-it1vE95zF6dTT9lBsYbxvqh0Soy4SPowchj0UBGj/V6cTPnXXtQOPUbhZ6CmGzAD/rW22LQK6E96pcdJXk4A4w==",
"dev": true,
"dependencies": {
"boolbase": "^1.0.0"
@@ -11641,9 +11641,9 @@
}
},
"nth-check": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.0.tgz",
- "integrity": "sha512-i4sc/Kj8htBrAiH1viZ0TgU8Y5XqCaV/FziYK6TBczxmeKm3AEFWqqF3195yKudrarqy7Zu80Ra5dobFjn9X/Q==",
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.1.tgz",
+ "integrity": "sha512-it1vE95zF6dTT9lBsYbxvqh0Soy4SPowchj0UBGj/V6cTPnXXtQOPUbhZ6CmGzAD/rW22LQK6E96pcdJXk4A4w==",
"dev": true,
"requires": {
"boolbase": "^1.0.0"
diff --git a/web/package.json b/web/package.json
index 068d5d6..6d19b6b 100644
--- a/web/package.json
+++ b/web/package.json
@@ -38,7 +38,7 @@
"lodash.invert": "^4.3.0",
"lodash.isequal": "^4.5.0",
"lodash.sortby": "^4.7.0",
- "maplibre-gl": "^1.13.0-rc.5",
+ "maplibre-gl": "^1.15.2",
"redom": "^3.27.1",
"title-case": "^2.1.1"
}
diff --git a/web/src/editbutton.js b/web/src/editbutton.js
index 9c3bbe2..83163d5 100644
--- a/web/src/editbutton.js
+++ b/web/src/editbutton.js
@@ -11,7 +11,7 @@ class EditButton {
};
this._control = el('div', button, {
- class: 'mapboxgl-ctrl',
+ class: 'maplibregl-ctrl',
});
map.on('zoomend', () => {
diff --git a/web/src/index.css b/web/src/index.css
index 29b8393..3a773c4 100644
--- a/web/src/index.css
+++ b/web/src/index.css
@@ -33,7 +33,7 @@ header {
font-size: 13px;
}
-header, .mapboxgl-ctrl.mapboxgl-ctrl-attrib {
+header, .maplibregl-ctrl.maplibregl-ctrl-attrib {
backdrop-filter: blur(3px) saturate(80%);
}
@@ -77,7 +77,7 @@ a {
clear: both;
}
-.mapboxgl-ctrl-attrib {
+.maplibregl-ctrl-attrib {
font-size: 10px;
line-height: 14px;
border-radius: 4px 0px 0px 0px;
diff --git a/web/src/index.js b/web/src/index.js
index d60e2ad..285fa58 100644
--- a/web/src/index.js
+++ b/web/src/index.js
@@ -1,6 +1,6 @@
import './index.css';
import '@russss/mapboxgl-layer-switcher/layerswitcher.css'
-import mapboxgl from 'maplibre-gl';
+import maplibregl from 'maplibre-gl';
import {mount} from 'redom';
@@ -23,7 +23,7 @@ import style_oim_petroleum from './style/style_oim_petroleum.js';
import style_oim_water from './style/style_oim_water.js';
function init() {
- if (!mapboxgl.supported({failIfMajorPerformanceCaveat: true})) {
+ if (!maplibregl.supported({failIfMajorPerformanceCaveat: true})) {
const infobox = new InfoBox('Warning');
infobox.update(
'Your browser may have performance or functionality issues with OpenInfraMap.<br/>' +
@@ -33,7 +33,7 @@ function init() {
mount(document.body, infobox);
}
- mapboxgl.setRTLTextPlugin(
+ maplibregl.setRTLTextPlugin(
'https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js',
null,
true, // Lazy load the plugin
@@ -75,7 +75,7 @@ function init() {
// map_style['sources']['solar_heatmap']['url'] = 'http://localhost:8081/capabilities/solar_heatmap.json'
}
- var map = new mapboxgl.Map(url_hash.init({
+ var map = new maplibregl.Map(url_hash.init({
container: 'map',
style: map_style,
minZoom: 2,
@@ -87,9 +87,9 @@ function init() {
map.touchZoomRotate.disableRotation();
url_hash.enable(map);
- map.addControl(new mapboxgl.NavigationControl({showCompass: false}), 'top-right');
+ map.addControl(new maplibregl.NavigationControl({showCompass: false}), 'top-right');
map.addControl(
- new mapboxgl.GeolocateControl({
+ new maplibregl.GeolocateControl({
positionOptions: {
enableHighAccuracy: true,
},
@@ -98,7 +98,7 @@ function init() {
);
map.addControl(new MapTilerAttribution(), 'bottom-right');
- map.addControl(new mapboxgl.ScaleControl({position: 'bottom-left'}));
+ map.addControl(new maplibregl.ScaleControl({position: 'bottom-left'}));
map.addControl(new KeyControl(), 'top-right');
map.addControl(layer_switcher, 'top-right');
diff --git a/web/src/infopopup.css b/web/src/infopopup.css
index 77c021f..0064615 100644
--- a/web/src/infopopup.css
+++ b/web/src/infopopup.css
@@ -2,28 +2,28 @@ table.item_info th {
text-align: left;
}
-.mapboxgl-popup {
+.maplibregl-popup {
max-width: 350px !important;
}
-.mapboxgl-popup .nameContainer {
+.maplibregl-popup .nameContainer {
margin-bottom: 5px;
}
-.mapboxgl-popup h3 {
+.maplibregl-popup h3 {
margin-top: 0px;
margin-bottom: 0px;
}
-.mapboxgl-popup h4::before {
+.maplibregl-popup h4::before {
content: "("
}
-.mapboxgl-popup h4::after {
+.maplibregl-popup h4::after {
content: ")"
}
-.mapboxgl-popup h4 {
+.maplibregl-popup h4 {
font-weight: normal;
margin-top: 0px;
margin-bottom: 0px;
diff --git a/web/src/infopopup.js b/web/src/infopopup.js
index 97bc700..2a7850a 100644
--- a/web/src/infopopup.js
+++ b/web/src/infopopup.js
@@ -1,6 +1,6 @@
import './infopopup.css';
-import mapboxgl from 'maplibre-gl';
+import maplibregl from 'maplibre-gl';
import titleCase from 'title-case';
import browserLanguage from 'in-browser-language';
import {local_name_tags} from './l10n.js';
@@ -199,7 +199,7 @@ class InfoPopup {
this.popup_obj.remove();
}
- this.popup_obj = new mapboxgl.Popup()
+ this.popup_obj = new maplibregl.Popup()
.setLngLat(e.lngLat)
.setDOMContent(this.popupHtml(e.features[0]))
.addTo(this._map);
diff --git a/web/src/key/key.js b/web/src/key/key.js
index d4b3c22..b5d9184 100644
--- a/web/src/key/key.js
+++ b/web/src/key/key.js
@@ -37,10 +37,10 @@ class KeyControl {
this._map = map;
this._control = el('button', {
- class: 'mapboxgl-ctrl-icon oim-key-control',
+ class: 'maplibregl-ctrl-icon oim-key-control',
});
- this._container = el('div', {class: 'mapboxgl-ctrl oim-key-panel'});
+ this._container = el('div', {class: 'maplibregl-ctrl oim-key-panel'});
this.populate();
@@ -52,7 +52,7 @@ class KeyControl {
setTimeout(e => this.resize(), 100);
this._map.on('resize', e => this.resize());
return el('div', this._control, this._container, {
- class: 'mapboxgl-ctrl mapboxgl-ctrl-group',
+ class: 'maplibregl-ctrl maplibregl-ctrl-group',
});
}
diff --git a/web/src/maptiler-attribution.js b/web/src/maptiler-attribution.js
index 02d9e72..8d337ee 100644
--- a/web/src/maptiler-attribution.js
+++ b/web/src/maptiler-attribution.js
@@ -16,7 +16,7 @@ class MapTilerAttribution {
);
this._control = el("div#maptiler-attribution", img, {
- class: "mapboxgl-ctrl"
+ class: "maplibregl-ctrl"
});
return this._control;