Skip to content
This repository was archived by the owner on Sep 30, 2020. It is now read-only.

Commit 2b087a5

Browse files
committed
fix(mapbox): change mapbox layer to current specs
1 parent b2011ad commit 2b087a5

File tree

5 files changed

+78
-20
lines changed

5 files changed

+78
-20
lines changed

dist/ui-leaflet-layers.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
22
* ui-leaflet-layers
33
*
4-
* @version: 0.1.1
4+
* @version: 0.1.2
55
* @author: Michael Salgado <[email protected]>
6-
* @date: Tue Sep 27 2016 11:41:57 GMT-0500 (COT)
6+
* @date: Wed Sep 28 2016 17:52:43 GMT-0500 (COT)
77
* @license: MIT
88
*/
99
(function (window, angular){
@@ -306,12 +306,12 @@ angular.module('ui-leaflet').config(function ($provide) {
306306
mapbox: {
307307
mustHaveKey: true,
308308
createLayer: function createLayer(params) {
309-
var version = 3;
310-
if (isDefined(params.options.version) && params.options.version === 4) {
311-
version = params.options.version;
312-
}
313-
var url = version === 3 ? '//{s}.tiles.mapbox.com/v3/' + params.key + '/{z}/{x}/{y}.png' : '//api.tiles.mapbox.com/v4/' + params.key + '/{z}/{x}/{y}.png?access_token=' + params.apiKey;
314-
return L.tileLayer(url, params.options);
309+
var url = '//api.mapbox.com/styles/v1/{user}/{mapId}/tiles/256/{z}/{x}/{y}?access_token={apiKey}';
310+
return L.tileLayer(url, angular.extend(params.options, {
311+
mapId: params.key,
312+
user: params.user,
313+
apiKey: params.apiKey
314+
}));
315315
}
316316
},
317317

dist/ui-leaflet-layers.js.map

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ui-leaflet-layers.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<html ng-app="demoapp">
2+
<head>
3+
<title>Mapbox Basic Example</title>
4+
<meta charset="utf-8">
5+
6+
<script src="../bower_components/angular/angular.min.js"></script>
7+
<script src="../bower_components/leaflet/dist/leaflet.js"></script>
8+
<script src="../bower_components/angular-simple-logger/dist/angular-simple-logger.js"></script>
9+
<script src="../bower_components/ui-leaflet/dist/ui-leaflet.js"></script>
10+
<script src="../dist/ui-leaflet-layers.js"></script>
11+
12+
<!-- Leaflet -->
13+
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
14+
15+
<!-- Mapbox GL -->
16+
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.11.2/mapbox-gl.css' rel='stylesheet' />
17+
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.11.2/mapbox-gl.js'></script>
18+
19+
<!-- Mapbox GL Leaflet Plugin -->
20+
<script src='https://rawgit.com/mapbox/mapbox-gl-leaflet/master/leaflet-mapbox-gl.js'></script>
21+
22+
<script>
23+
var app = angular.module("demoapp", ['ui-leaflet']);
24+
app.controller('MapboxBasicExample', function($scope, $timeout, leafletLayersLogger) {
25+
leafletLayersLogger.currentLevel = leafletLayersLogger.LEVELS.debug;
26+
angular.extend($scope, {
27+
center: {
28+
lat: 38.91275,
29+
lng: -77.032194,
30+
zoom: 8
31+
},
32+
layers: {
33+
baselayers: {
34+
mapbox_basic: {
35+
name: 'Mapbox Basic',
36+
type: 'mapbox',
37+
key: 'citng102800332hphzmbjudn7',
38+
user: 'elesdoar',
39+
apiKey: 'pk.eyJ1IjoiZWxlc2RvYXIiLCJhIjoiY2l0bmcwaDNpMDQzMTJvbDRpaTltN2dlbiJ9.KDnhRVh9St6vpQovMI7iLg'
40+
},
41+
mapbox_outdoors: {
42+
name: 'Mapbox Outdoors',
43+
type: 'mapbox',
44+
key: 'citng3g0g003s2it88y9lg769',
45+
user: 'elesdoar',
46+
apiKey: 'pk.eyJ1IjoiZWxlc2RvYXIiLCJhIjoiY2l0bmcwaDNpMDQzMTJvbDRpaTltN2dlbiJ9.KDnhRVh9St6vpQovMI7iLg'
47+
}
48+
},
49+
overlays: {}
50+
}
51+
});
52+
});
53+
</script>
54+
</head>
55+
56+
<body ng-controller="MapboxBasicExample">
57+
<h2>Mapbox Basic Example</h2>
58+
<leaflet lf-center="center" layers="layers" height="480px" width="100%"></leaflet>
59+
</body>
60+
</html>

0 commit comments

Comments
 (0)