forked from coryasilva/Leaflet.ExtraMarkers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
183 lines (171 loc) · 5.16 KB
/
test.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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>TEST</title>
<meta name="viewport" content="width=device-width">
<!-- Bootstrap -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<!-- Font Awesome 4 -->
<!-- <link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.css" /> -->
<!-- Font Awesome 5 -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<!-- Font Awesome 5 SVG -->
<!-- <script defer src="https://use.fontawesome.com/releases/v5.6.3/js/all.js" integrity="sha384-EIHISlAOj4zgYieurP0SdoiBYfGJKkgWedPHH4jCzpCXLmzVsw1ouK59MuUtP4a1" crossorigin="anonymous"></script> -->
<!-- Semantic UI -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.3.1/dist/semantic.min.css">
<!-- Leaflet -->
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.1/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet@1.3.1/dist/leaflet.js"></script>
<!-- Extra Markers -->
<link rel="stylesheet" href="/dist/css/leaflet.extra-markers.min.css" />
<script src="/dist/js/leaflet.extra-markers.min.js"></script>
</head>
<body>
<div id="map" class="ui" style="width: 100%; height: 400px;"></div>
<script>
// Setup map
var map = L.map('map').setView([33.00, -117.255], 14);
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',
detectRetina: true
}).addTo(map);
// Add markers to map
// Font-Awesome markers
L.marker([33.005, -117.270], {
icon: L.ExtraMarkers.icon({
icon: 'fa-spinner',
shape: 'circle',
markerColor: 'red',
prefix: 'fa',
extraClasses: 'fa-spin'
})
}).addTo(map);
L.marker([33.005, -117.265], {
icon: L.ExtraMarkers.icon({
icon: 'fa-coffee',
shape: 'square',
markerColor: 'orange-dark',
prefix: 'fa',
iconColor: 'black'
})
}).addTo(map);
L.marker([33.005, -117.260], {
icon: L.ExtraMarkers.icon({
icon: 'fa-cog',
shape: 'star',
prefix: 'fa',
extraClasses: 'fa-5x',
markerColor: 'orange',
iconColor: '#6b1d5c'
})
}).addTo(map);
L.marker([33.005, -117.255], {
icon: L.ExtraMarkers.icon({
icon: 'fa-spinner',
shape: 'penta',
markerColor: 'yellow',
prefix: 'fa'
})
}).addTo(map);
//Semantic UI
L.marker([33.005, -117.250], {
icon: L.ExtraMarkers.icon({
icon: 'add sign',
shape: 'circle',
markerColor: 'blue-dark',
prefix: 'icon'
})
}).addTo(map);
L.marker([33.005, -117.245], {
icon: L.ExtraMarkers.icon({
icon: ' archive',
shape: 'square',
markerColor: 'cyan',
prefix: 'icon'
})
}).addTo(map);
L.marker([33.005, -117.240], {
icon: L.ExtraMarkers.icon({
icon: 'sync',
shape: 'penta',
markerColor: 'purple',
prefix: 'icon'
})
}).addTo(map);
// Second Row
L.marker([32.995, -117.270], {
icon: L.ExtraMarkers.icon({
icon: 'plus sign',
shape: 'circle',
markerColor: 'violet',
prefix: 'icon'
})
}).addTo(map);
// Glyphicons
L.marker([32.995, -117.265], {
icon: L.ExtraMarkers.icon({
icon: 'glyphicon-cog',
shape: 'square',
prefix: 'glyphicon',
markerColor: 'pink'
})
}).addTo(map);
L.marker([32.995, -117.260], {
icon: L.ExtraMarkers.icon({
icon: 'fa-igloo',
shape: 'star',
prefix: 'fas',
markerColor: 'green-dark'
})
}).addTo(map);
L.marker([32.995, -117.255], {
icon: L.ExtraMarkers.icon({
icon: 'fa-number',
shape: 'penta',
markerColor: 'green',
number: '1'
})
}).addTo(map);
L.marker([32.995, -117.250], {
icon: L.ExtraMarkers.icon({
icon: 'glyphicon-cog',
shape: 'circle',
prefix: 'glyphicon',
markerColor: 'green-light'
})
}).addTo(map);
// No Icons
L.marker([32.995, -117.245], {
icon: L.ExtraMarkers.icon({
icon: 'fa-number',
number: '42',
shape: 'square',
markerColor: 'black'
})
}).addTo(map);
L.marker([32.995, -117.240], {
icon: L.ExtraMarkers.icon({
icon: 'fa-number',
number: '42',
iconColor: 'black',
shape: 'star',
markerColor: 'white'
})
}).addTo(map);
//adds pop up to each marker
map.eachLayer(function (layer) {
if(layer._icon && layer._icon.className.includes('leaflet-marker-icon')) {
var popUpTextArray = [];
console.log(layer)
popUpTextArray.push('icon: ' + layer.options.icon.options.icon);
popUpTextArray.push('shape: ' + layer.options.icon.options.shape);
popUpTextArray.push('markerColor: ' + layer.options.icon.options.markerColor);
var popUpText = popUpTextArray.join('<br />');
layer.bindPopup(popUpText);
}
});
</script>
</body>
</html>