forked from tombatossals/angular-leaflet-directive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
0201-layers-simple-example.html
51 lines (51 loc) · 2.21 KB
/
0201-layers-simple-example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE html>
<html ng-app="demoapp">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="../bower_components/angular/angular.min.js"></script>
<script src="../bower_components/leaflet/dist/leaflet.js"></script><script src="../bower_components/angular-simple-logger/dist/index.js"></script>
<script src="../dist/angular-leaflet-directive.min.js"></script>
<link rel="stylesheet" href="../bower_components/leaflet/dist/leaflet.css" />
<script>
var app = angular.module("demoapp", ["leaflet-directive"]);
app.controller("LayersSimpleController", [ "$scope", function($scope) {
angular.extend($scope, {
center: {
lat: 25.0391667,
lng: 121.525,
zoom: 6
},
markers: {
taipei: {
lat: 25.0391667,
lng: 121.525,
}
},
layers: {
baselayers: {
mapbox_light: {
name: 'Mapbox Light',
url: 'http://api.tiles.mapbox.com/v4/{mapid}/{z}/{x}/{y}.png?access_token={apikey}',
type: 'xyz',
layerOptions: {
apikey: 'pk.eyJ1IjoiYnVmYW51dm9scyIsImEiOiJLSURpX0pnIn0.2_9NrLz1U9bpwMQBhVk97Q',
mapid: 'bufanuvols.lia22g09'
}
},
osm: {
name: 'OpenStreetMap',
url: 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
type: 'xyz'
}
}
}
});
}]);
</script>
</head>
<body ng-controller="LayersSimpleController">
<leaflet lf-center="center" markers="markers" layers="layers" width="100%" height="480px"></leaflet>
<h1>Layers simple example</h1>
<p>You can easily add various layers to your map, including a layer selector on the top right, defining <strong>layers</strong> object.</p>
</body>
</html>