Skip to content

Commit e8caaf9

Browse files
committed
refactor(map): switch back to Mapbox
Switch back to Mapbox and use mapbox-gl-js
1 parent b032ba5 commit e8caaf9

4 files changed

Lines changed: 15 additions & 14 deletions

File tree

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
<div class="leaflet-map">
2-
<a href="https://www.maptiler.com" style="position:absolute;right:10px;bottom:20px;z-index:999;"><img src="https://api.maptiler.com/resources/logo.svg" alt="MapTiler logo"></a>
32
<div ng-transclude></div>
43
</div>

app/components/leaflet.directive.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,16 @@
9696
});
9797

9898
const key = '@@OPENSENSEMAP_ACCESS_TOKEN';
99-
const styleUrl = '@@OPENSENSEMAP_STYLE_URL'
100-
const gl = L.maplibreGL({
101-
attribution: "\u003ca href=\"https://www.maptiler.com/copyright/\" target=\"_blank\"\u003e\u0026copy; MapTiler\u003c/a\u003e \u003ca href=\"https://www.openstreetmap.org/copyright\" target=\"_blank\"\u003e\u0026copy; OpenStreetMap contributors\u003c/a\u003e",
102-
style: styleUrl + "?key=" + key
99+
const styleUrl = '@@OPENSENSEMAP_STYLE_URL';
100+
101+
var gl = L.mapboxGL({
102+
attribution: '© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a></strong>',
103+
accessToken: '@@OPENSENSEMAP_ACCESS_TOKEN',
104+
style: '@@OPENSENSEMAP_STYLE_URL'
103105
}).addTo(map);
104-
var maplibreMap = gl.getMaplibreMap();
106+
var mapboxMap = gl.getMapboxMap();
105107

106-
maplibreMap.on('load', layerLoaded);
108+
mapboxMap.on('load', layerLoaded);
107109

108110
L.control.scale().addTo(map);
109111

@@ -153,7 +155,7 @@
153155
function layerLoaded () {
154156
$rootScope.$broadcast('layerloaded', {});
155157
$rootScope.$apply();
156-
maplibreMap.off('load', layerLoaded);
158+
mapboxMap.off('load', layerLoaded);
157159
for (var layerName in mapLayers) {
158160
mapLayers[layerName].on('add', function () {
159161
osemMapData.setLayer(layerName, mapLayers[layerName]);

app/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<link rel="stylesheet" href="bower_components/bootstrap-css-only/css/bootstrap.css" />
3838
<link rel="stylesheet" href="bower_components/Leaflet.awesome-markers/dist/leaflet.awesome-markers.css" />
3939
<link rel="stylesheet" href="bower_components/leaflet.markercluster/dist/MarkerCluster.css" />
40-
<link rel="stylesheet" href="bower_components/maplibre-gl-css/index.css" />
40+
<link rel="stylesheet" href="bower_components/mapbox-gl-css/index.css" />
4141
<link rel="stylesheet" href="bower_components/ngprogress/ngProgress.css" />
4242
<!-- endbower -->
4343
<!-- endbuild -->
@@ -368,8 +368,8 @@
368368
<script src="bower_components/angular-wizard/dist/angular-wizard.min.js"></script>
369369
<script src="bower_components/Leaflet.awesome-markers/dist/leaflet.awesome-markers.js"></script>
370370
<script src="bower_components/leaflet.markercluster/dist/leaflet.markercluster-src.js"></script>
371-
<script src="bower_components/maplibre-gl-js/index.js"></script>
372-
<script src="bower_components/maplibre-gl-leaflet/index.js"></script>
371+
<script src="bower_components/mapbox-gl-js/index.js"></script>
372+
<script src="bower_components/mapbox-gl-leaflet/leaflet-mapbox-gl.js"></script>
373373
<script src="bower_components/d3/d3.js"></script>
374374
<script src="bower_components/Leaflet.FeatureGroup.SubGroup/src/subgroup.js"></script>
375375
<script src="bower_components/angular-ismobile/dist/angular-ismobile.js"></script>

bower.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
"leaflet": "1.7.1",
2323
"Leaflet.awesome-markers": "leaflet-awesome-markers#^2.0.2",
2424
"leaflet.markercluster": "1.4.1",
25-
"maplibre-gl-js": "https://unpkg.com/maplibre-gl@2.4.0/dist/maplibre-gl.js",
26-
"maplibre-gl-css": "https://unpkg.com/maplibre-gl@2.4.0/dist/maplibre-gl.css",
27-
"maplibre-gl-leaflet": "https://unpkg.com/@maplibre/maplibre-gl-leaflet@0.0.17/leaflet-maplibre-gl.js",
25+
"mapbox-gl-js": "https://api.mapbox.com/mapbox-gl-js/v1.13.1/mapbox-gl.js",
26+
"mapbox-gl-css": "https://api.mapbox.com/mapbox-gl-js/v1.13.1/mapbox-gl.css",
27+
"mapbox-gl-leaflet": "https://github.com/mapbox/mapbox-gl-leaflet.git#f3901fc",
2828
"d3": "^4.10.0",
2929
"Leaflet.FeatureGroup.SubGroup": "^1.0.3",
3030
"angular-ismobile": "^1.1.0",

0 commit comments

Comments
 (0)