This repository has been archived by the owner on Sep 20, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 134
/
MarkersClustering10000MarkersNoWatchController.js
60 lines (60 loc) · 2.16 KB
/
MarkersClustering10000MarkersNoWatchController.js
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
52
53
54
55
56
57
58
59
60
app.controller("MarkersClustering10000MarkersNoWatchController", ["$scope", "$http", "leafletData",
function($scope, $http, leafletData) {
var addressPointsToMarkers = function(points) {
return points.map(function(ap) {
return {
layer: 'realworld',
lat: ap[0],
lng: ap[1]
};
});
};
angular.extend($scope, {
center: {
lat: -37.9212959167,
lng: 175.5604435167,
zoom: 11
},
watchOptions: {
markers: {
type: null,
individual: {
type: null
}
}
},
events: {
map: {
enable: ['moveend', 'popupopen'],
logic: 'emit'
},
marker: {
enable: [],
logic: 'emit'
}
},
layers: {
baselayers: {
osm: {
name: 'OpenStreetMap',
type: 'xyz',
url: 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
}
},
overlays: {
realworld: {
name: "Real world data",
type: "markercluster",
visible: true
}
}
}
});
$http.get("json/realworld.10000.json").success(function(data) {
leafletData.getDirectiveControls().then(function (controls) {
var markers = addressPointsToMarkers(data)
controls.markers.create(markers ,$scope.markers);
$scope.markers = markers;
});
});
}]);