In the leaflet.js documentation an example with layers of markers is documented. I would like to create a layer of polygons in GeoJSON format. Is this possible?
I've defined a variable for each GeoJSON polygon, called route1, route2 etc. My .js file looks like this:
var map = L.map('map', {
center: [55.676098, 12.568337],
});
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
//============
//Create layer
//============
var Southroutes = new L.layerGroup([route1, route2, route3, route4, route5]);
L.geoJSON(Southroutes).addTo(map);