-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
205 lines (191 loc) · 7.09 KB
/
index.html
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html {
height: 100%
}
body {
height: 100%;
margin: 0;
padding: 0
}
#map-canvas {
height: 100%;
z-index:1;
}
#maptypes {
position:absolute;
top:50px;
right:10px;
z-index:1000;
}
#maptypes ul {
list-style-type: none;
}
#maptypes li {
display:none;
height:64px;
width:64px;
border: 1px solid #202020;
background-color: #fff;
}
#maptypes .title {
top: 0px;
right: 0px;
display: block;
width: 64px;
border: 1px solid #000;
background-color: #E2E2E2;
color: #000;
position: absolute;
font: bold 13px Veranda, sans-serif;
margin: 0;
text-align: center;
}
#maptypes li.active {
display:block;
opacity: 1;
}
.hover-disabled {
filter: brightness(.75);
-webkit-filter: brightness(.75);
-moz-filter: brightness(.75);
-o-filter: brightness(.75);
-ms-filter: brightness(.75);
}
.hover-enabled {
filter: brightness(1);
-webkit-filter: brightness(1);
-moz-filter: brightness(1);
-o-filter: brightness(1);
-ms-filter: brightness(1);
}
.greyscale {
background: #202020 url("images/greyscale.png") no-repeat;
color: #fff;
}
.toner {
background: #202020 url("images/toner.png") no-repeat;
color: #fff;
}
.watercolor {
background: #202020 url("images/watercolor.png") no-repeat;
color: #fff;
}
.openstreets {
background: #202020 url("images/osm.png") no-repeat;
color: #fff;
}
.roadmap {
background: #202020 url("images/roadmap.png") no-repeat;
color: #fff;
}
.satellite {
background: #202020 url("images/satellite.png") no-repeat;
color: #fff;
}
.hybrid {
background: #202020 url("images/hybrid.png") no-repeat;
color: #fff;
}
.terrain {
background: #202020 url("images/terrain.png") no-repeat;
color: #fff;
}
</style>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false">
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script type="text/javascript">
google.maps.visualRefresh = true;
var selectedMap;
function initialize() {
//create some custom map types
var mapTypeIds = ["Greyscale", "Toner", "Watercolor", "Open Streets", "RoadMap", "Satellite", "Hybrid", "Terrain"];
//custom greyscale map
var greyscale = [{
"featureType": "all",
"elementType": "all",
"stylers": [{
"saturation": -100
}]
}, {
"featureType": "road",
"elementType": "labels",
"stylers": [{
"visibility": "off"
}]
}, {
"featureType": "transit",
"stylers": [{
"visibility": "off"
}]
}, {
"featureType": "water",
"stylers": [{
"saturation": 1
}, {
"color": "#808080"
}]
}];
var greyStyle = new google.maps.StyledMapType(greyscale, {
name: "Greyscale"
});
var mapOptions = {
center: new google.maps.LatLng(37.804, - 122.269),
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: false
};
var map = new google.maps.Map(document.getElementById("map-canvas"),
mapOptions);
map.mapTypes.set('greyscale', greyStyle);
//add open street map DK
map.mapTypes.set("openstreets", new google.maps.ImageMapType({
getTileUrl: function(coord, zoom) {
return "http://tile.openstreetmap.org/" + zoom + "/" + coord.x + "/" + coord.y + ".png";
},
tileSize: new google.maps.Size(256, 256),
name: "openstreet",
maxZoom: 18
}));
map.mapTypes.set("watercolor", new google.maps.StamenMapType("watercolor"));
map.mapTypes.set("toner", new google.maps.StamenMapType("toner"));
//create maptype control
$.each(mapTypeIds, function(index, item) {
var mapText = item.toLowerCase();
mapText = mapText.replace(/\s+/g, '');
$("#maptypes ul").append("<li id='" + mapText + "' class='mp hover-disabled " + mapText + "'></li>");
});
$("#maptypes ul").hover(function() {
$("#maptypes li").show();
$("#maptypes li").hover(function() {
$(this).addClass('hover-enabled');
}, function() {
$(this).removeClass('hover-enabled');
})
}, function() {
$("#maptypes li").hide();
$("." + selectedMap).show();
})
$("#maptypes li").click(function() {
selectedMap = $(this).attr('id');
map.setMapTypeId(selectedMap);
});
map.setMapTypeId('roadmap');
$("#roadmap").addClass("active");
selectedMap = "roadmap";
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="maptypes">
<p class="title">Map</p><ul></ul>
</div>
<div id="map-canvas" />
</body>
<script type="text/javascript" src="http://maps.stamen.com/js/tile.stamen.js?v1.2.1"></script>
</html>