-
Notifications
You must be signed in to change notification settings - Fork 824
/
Copy pathindex.ts
150 lines (146 loc) · 4.01 KB
/
index.ts
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
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
// [START maps_maptype_styled_simple]
function initMap(): void {
// Create a new StyledMapType object, passing it an array of styles,
// and the name to be displayed on the map type control.
const styledMapType = new google.maps.StyledMapType(
[
{ elementType: "geometry", stylers: [{ color: "#ebe3cd" }] },
{ elementType: "labels.text.fill", stylers: [{ color: "#523735" }] },
{ elementType: "labels.text.stroke", stylers: [{ color: "#f5f1e6" }] },
{
featureType: "administrative",
elementType: "geometry.stroke",
stylers: [{ color: "#c9b2a6" }],
},
{
featureType: "administrative.land_parcel",
elementType: "geometry.stroke",
stylers: [{ color: "#dcd2be" }],
},
{
featureType: "administrative.land_parcel",
elementType: "labels.text.fill",
stylers: [{ color: "#ae9e90" }],
},
{
featureType: "landscape.natural",
elementType: "geometry",
stylers: [{ color: "#dfd2ae" }],
},
{
featureType: "poi",
elementType: "geometry",
stylers: [{ color: "#dfd2ae" }],
},
{
featureType: "poi",
elementType: "labels.text.fill",
stylers: [{ color: "#93817c" }],
},
{
featureType: "poi.park",
elementType: "geometry.fill",
stylers: [{ color: "#a5b076" }],
},
{
featureType: "poi.park",
elementType: "labels.text.fill",
stylers: [{ color: "#447530" }],
},
{
featureType: "road",
elementType: "geometry",
stylers: [{ color: "#f5f1e6" }],
},
{
featureType: "road.arterial",
elementType: "geometry",
stylers: [{ color: "#fdfcf8" }],
},
{
featureType: "road.highway",
elementType: "geometry",
stylers: [{ color: "#f8c967" }],
},
{
featureType: "road.highway",
elementType: "geometry.stroke",
stylers: [{ color: "#e9bc62" }],
},
{
featureType: "road.highway.controlled_access",
elementType: "geometry",
stylers: [{ color: "#e98d58" }],
},
{
featureType: "road.highway.controlled_access",
elementType: "geometry.stroke",
stylers: [{ color: "#db8555" }],
},
{
featureType: "road.local",
elementType: "labels.text.fill",
stylers: [{ color: "#806b63" }],
},
{
featureType: "transit.line",
elementType: "geometry",
stylers: [{ color: "#dfd2ae" }],
},
{
featureType: "transit.line",
elementType: "labels.text.fill",
stylers: [{ color: "#8f7d77" }],
},
{
featureType: "transit.line",
elementType: "labels.text.stroke",
stylers: [{ color: "#ebe3cd" }],
},
{
featureType: "transit.station",
elementType: "geometry",
stylers: [{ color: "#dfd2ae" }],
},
{
featureType: "water",
elementType: "geometry.fill",
stylers: [{ color: "#b9d3c2" }],
},
{
featureType: "water",
elementType: "labels.text.fill",
stylers: [{ color: "#92998d" }],
},
],
{ name: "Styled Map" }
);
// Create a map object, and include the MapTypeId to add
// to the map type control.
const map = new google.maps.Map(
document.getElementById("map") as HTMLElement,
{
center: { lat: 55.647, lng: 37.581 },
zoom: 11,
mapTypeControlOptions: {
mapTypeIds: ["roadmap", "satellite", "hybrid", "terrain", "styled_map"],
},
}
);
//Associate the styled map with the MapTypeId and set it to display.
map.mapTypes.set("styled_map", styledMapType);
map.setMapTypeId("styled_map");
}
declare global {
interface Window {
initMap: () => void;
}
}
window.initMap = initMap;
// [END maps_maptype_styled_simple]
export {};