This repository has been archived by the owner on Dec 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
events-manager-osm.js
50 lines (48 loc) · 1.63 KB
/
events-manager-osm.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
/*global google, jQuery*/
/*jslint browser: true, unparam: true*/
function replaceMap(e, map) {
'use strict';
map.mapTypes.set(
"OSM",
new google.maps.ImageMapType(
{
getTileUrl: function (coord, zoom) {
return "https://a.tile.openstreetmap.org/" + zoom + "/" + coord.x + "/" + coord.y + ".png";
},
tileSize: new google.maps.Size(256, 256),
name: "OpenStreetMap",
maxZoom: 18
}
)
);
map.mapTypes.set(
"transport",
new google.maps.ImageMapType(
{
getTileUrl: function (coord, zoom) {
return "https://a.tile.thunderforest.com/transport/" + zoom + "/" + coord.x + "/" + coord.y + ".png";
},
tileSize: new google.maps.Size(256, 256),
name: "OSM Transport",
maxZoom: 18
}
)
);
map.mapTypeId = 'OSM';
map.setOptions(
{
mapTypeControl: true,
mapTypeControlOptions: {
mapTypeIds: ['OSM', 'transport']
}
}
);
var copyright = document.createElement('div');
copyright.innerHTML = '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors';
copyright.style.backgroundColor = 'rgba(245, 245, 245, 0.7)';
copyright.style.padding = '0 6px';
copyright.style.fontSize = '10px';
copyright.style.color = '#444';
map.controls[google.maps.ControlPosition.BOTTOM_RIGHT].push(copyright);
}
jQuery(document).bind('em_maps_location_hook', replaceMap);