UNPKG

mohsen-angular-leaflet-directive

Version:

angular-leaflet-directive - An AngularJS directive to easily interact with Leaflet maps

49 lines (48 loc) 2.15 kB
<!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="../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("LayersImageOverlayController", [ "$scope", "leafletLogger", "leafletData", "leafletBoundsHelpers", function($scope, leafletLogger, leafletData, leafletBoundsHelpers) { var maxbounds = leafletBoundsHelpers.createBoundsFromArray([[-540, -960], [540, 960]]); angular.extend($scope, { defaults: { scrollWheelZoom: false, crs: 'Simple', maxZoom: 2 }, center: { lat: 0, lng: 0, zoom: 0 }, maxbounds: maxbounds, layers: { baselayers: { sanfrancisco: { name: 'Andes', type: 'imageOverlay', url: 'images/andes.jpg', bounds: [[-540, -960], [540, 960]], layerParams: { showOnSelector: false, noWrap: true, attribution: 'Creative Commons image found <a href="http://www.flickr.com/photos/c32/8025422440/">here</a>' } } }, } }); }]); </script> </head> <body ng-controller="LayersImageOverlayController"> <leaflet lf-center="center" lf-defaults="defaults" lf-layers="layers" lf-maxbounds="maxbounds" height="480px" width="100%"></leaflet> <h1>Layer with image overlay and maxBounds</h1> </body> </html>