|
1 | 1 | $(document).ready(function () {
|
2 | 2 | var nodeLocation = new google.maps.LatLng(node.latitude, node.longitude);
|
| 3 | + |
3 | 4 | var myOptions = {
|
4 |
| - zoom: 15, |
5 |
| - center: nodeLocation, |
6 |
| - scrollwheel: false, |
7 |
| - navigationControl: false, |
8 |
| - scaleControl: false, |
9 |
| - draggable: false, |
10 |
| - mapTypeId: google.maps.MapTypeId.ROADMAP, |
11 |
| - streetViewControl: false |
| 5 | + 'zoom': 15, |
| 6 | + 'center': nodeLocation, |
| 7 | + 'scrollwheel': false, |
| 8 | + 'navigationControl': false, |
| 9 | + 'scaleControl': false, |
| 10 | + 'draggable': false, |
| 11 | + // TODO: allow user to set default layer |
| 12 | + 'mapTypeId': google.maps.MapTypeId.ROADMAP, |
| 13 | + 'mapTypeControlOptions': { |
| 14 | + 'mapTypeIds': [ |
| 15 | + 'OpenStreetMap', |
| 16 | + google.maps.MapTypeId.ROADMAP, |
| 17 | + google.maps.MapTypeId.SATELLITE |
| 18 | + ] |
| 19 | + }, |
| 20 | + 'streetViewControl': false |
12 | 21 | };
|
| 22 | + |
13 | 23 | var map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);
|
| 24 | + |
| 25 | + map.mapTypes.set('OpenStreetMap', new google.maps.ImageMapType({ |
| 26 | + getTileUrl: function(coordinates, zoom) { |
| 27 | + return 'http://tile.openstreetmap.org/' + zoom + '/' + coordinates.x + '/' + coordinates.y + '.png'; |
| 28 | + }, |
| 29 | + 'tileSize': new google.maps.Size(256, 256), |
| 30 | + 'name': 'OpenStreetMap', |
| 31 | + 'maxZoom': 18 |
| 32 | + })); |
| 33 | + |
| 34 | + var marker = new google.maps.Marker({ |
| 35 | + 'position': nodeLocation, |
| 36 | + 'map': map, |
| 37 | + 'title': node.name |
| 38 | + }); |
| 39 | + |
14 | 40 | var nodeName = $('<p/>').text(node.name).append(' | ');
|
15 | 41 | var nodeWebsite = $('<a/>').prop('href', node.url).text(gettext("more info"));
|
16 | 42 | nodeName.append(nodeWebsite);
|
17 | 43 | $('#map_info').append(nodeName);
|
18 |
| - var marker = new google.maps.Marker({ |
19 |
| - position: nodeLocation, |
20 |
| - map: map, |
21 |
| - title: node.name |
22 |
| - }); |
23 | 44 | });
|
0 commit comments