mohsen-angular-leaflet-directive
Version:
angular-leaflet-directive - An AngularJS directive to easily interact with Leaflet maps
52 lines (51 loc) • 2.19 kB
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="../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" lf-markers="markers" lf-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>