-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
27 lines (22 loc) · 804 Bytes
/
main.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
var map = L.map('map').setView(center, 18);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
// customize functions
function createPopup(layer) {
return layer.feature.properties.name + "<br>" + layer.feature.properties.description;
}
function createMarker(geoJsonPoint, latlng) {
var icon = geoJsonPoint.properties.icon;
return L.marker(latlng, {
icon: L.divIcon({
html: '<i class="fa ' + icon + '"></i>',
iconSize: [20, 20],
className: 'StandIcon'
})
});
}
// customize the stands
var stand_geo = L.geoJSON(stands, {pointToLayer: createMarker}).bindPopup(createPopup);
// add stands to the map
var contentLayer = stand_geo.addTo(map);