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 airportIcon = emoji_icon("✈️");
|
||||
var icons = {
|
||||
"station": emoji_icon("🚉"),
|
||||
"airport": emoji_icon("✈️"),
|
||||
"accommodation": emoji_icon("🏨"),
|
||||
}
|
||||
|
||||
function build_map(map_id, coordinates, routes) {
|
||||
// Initialize the map
|
||||
|
@ -22,8 +25,7 @@ function build_map(map_id, coordinates, routes) {
|
|||
|
||||
// Add markers with appropriate icons to the map
|
||||
coordinates.forEach(function(item) {
|
||||
var icon = item.type === "station" ? stationIcon : airportIcon;
|
||||
var marker = L.marker([item.latitude, item.longitude], { icon: icon }).addTo(map);
|
||||
var marker = L.marker([item.latitude, item.longitude], { icon: icons[item.type] }).addTo(map);
|
||||
marker.bindPopup(item.name);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue