Show accommodation pins on the map
This commit is contained in:
parent
f60a1a329c
commit
7ca5eafd1d
|
@ -6,8 +6,11 @@ function emoji_icon(emoji) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var stationIcon = emoji_icon("🚉");
|
var icons = {
|
||||||
var airportIcon = emoji_icon("✈️");
|
"station": emoji_icon("🚉"),
|
||||||
|
"airport": emoji_icon("✈️"),
|
||||||
|
"accommodation": emoji_icon("🏨"),
|
||||||
|
}
|
||||||
|
|
||||||
function build_map(map_id, coordinates, routes) {
|
function build_map(map_id, coordinates, routes) {
|
||||||
// Initialize the map
|
// Initialize the map
|
||||||
|
@ -22,8 +25,7 @@ function build_map(map_id, coordinates, routes) {
|
||||||
|
|
||||||
// Add markers with appropriate icons to the map
|
// Add markers with appropriate icons to the map
|
||||||
coordinates.forEach(function(item) {
|
coordinates.forEach(function(item) {
|
||||||
var icon = item.type === "station" ? stationIcon : airportIcon;
|
var marker = L.marker([item.latitude, item.longitude], { icon: icons[item.type] }).addTo(map);
|
||||||
var marker = L.marker([item.latitude, item.longitude], { icon: icon }).addTo(map);
|
|
||||||
marker.bindPopup(item.name);
|
marker.bindPopup(item.name);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue