Skip to content

Commit 010c11b

Browse files
author
Paweł Marynowski
committed
feat(services): add map service
1 parent 2853abf commit 010c11b

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

src/services/map.service.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import '../images/marker.png';
2+
3+
const MapService = () => {
4+
const service = {
5+
getMapIcon,
6+
getMapInstance,
7+
};
8+
9+
return service;
10+
11+
//
12+
13+
function getMapIcon(options) {
14+
return angular.extend({
15+
iconUrl: 'assets/images/marker.png',
16+
shadowUrl: undefined,
17+
iconSize: [40, 40],
18+
shadowSize: [0, 0],
19+
iconAnchor: [20, 20],
20+
shadowAnchor: [0, 0],
21+
}, options);
22+
}
23+
24+
function getMapInstance(options) {
25+
return angular.extend({
26+
center: {
27+
lat: 51.686,
28+
lng: 19.545,
29+
zoom: 7,
30+
},
31+
markers: {},
32+
layers: {
33+
baselayers: {
34+
osm: {
35+
name: 'OpenStreetMap',
36+
type: 'xyz',
37+
url: '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
38+
layerOptions: {
39+
subdomains: ['a', 'b', 'c'],
40+
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
41+
continuousWorld: true,
42+
},
43+
},
44+
},
45+
overlays: {
46+
monuments: {
47+
name: 'Monuments',
48+
type: 'markercluster',
49+
visible: true,
50+
},
51+
},
52+
},
53+
}, options);
54+
}
55+
};
56+
57+
export default () => {
58+
angular
59+
.module('monumental')
60+
.factory('mapService', MapService);
61+
};

0 commit comments

Comments
 (0)