document.addEventListener(‘DOMContentLoaded’, function() {
var map = L.map(‘map’).setView([42.185, 2.985], 11);
L.tileLayer(‘https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png’, {
attribution: ‘© OpenStreetMap’
}).addTo(map);
var rutas = [
{nombre: «Mas Torrencito», coords: [42.185, 2.985], tipo: «base»},
{nombre: «Albanyà – Gorgs», coords: [42.315, 2.745], tipo: «norte»},
{nombre: «Sant Llorenç», coords: [42.305, 2.825], tipo: «norte»},
{nombre: «La Vajol», coords: [42.425, 2.815], tipo: «norte»},
{nombre: «Vulpellac», coords: [41.985, 3.095], tipo: «centro»},
{nombre: «Madremanya», coords: [41.965, 3.045], tipo: «centro»},
{nombre: «Cruïlles», coords: [42.015, 3.065], tipo: «centro»},
{nombre: «Sant Mori», coords: [42.145, 2.945], tipo: «centro»},
{nombre: «Palau-sator», coords: [42.035, 3.125], tipo: «costa»},
{nombre: «Sant Martí», coords: [42.145, 3.135], tipo: «costa»},
{nombre: «Les Planes», coords: [42.065, 2.565], tipo: «excepcion»}
];
var colors = {base: ‘#e74c3c’, norte: ‘#3498db’, centro: ‘#9b59b6’, costa: ‘#1abc9c’, excepcion: ‘#f39c12’};
rutas.forEach(function(ruta) {
L.circleMarker(ruta.coords, {
radius: 11,
fillColor: colors[ruta.tipo],
color: ‘#fff’,
weight: 4,
fillOpacity: 0.85
}).addTo(map).bindPopup(«
» + ruta.nombre + ««);
});
map.fitBounds([[42.425, 2.565],[41.965, 3.135]]);
});