Free javascript Hosting


maps-gm.js

Uploaded on Jan 06 2022 18:01 by christophe

// set up the map
map = new L.Map('map', {scrollWheelZoom: true});

// map.once('focus', function() { map.scrollWheelZoom.enable(); });

// create the tile layer with correct attribution
var osmUrl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
var osmAttrib='Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors';
var osm = new L.TileLayer(osmUrl, {minZoom: 8, maxZoom: 18, attribution: osmAttrib});

// start the map in South-East England
map.setView(new L.LatLng(45.9387, 5.5756),9);
map.addLayer(osm);



L.Control.Watermark = L.Control.extend({
onAdd: function(map) {
var img = L.DomUtil.create('img');

img.src = 'https://www.insa-lyon.fr/sites/all/themes/insa/logo.png';
img.style.width = '200px';

return img;
},
onRemove: function(map) {
// Nothing to do here
}
});
L.control.watermark = function(opts) {return new L.Control.Watermark(opts);}
L.control.watermark({ position: 'bottomleft' }).addTo(map);



var iconINSA = L.icon({
iconUrl: 'https://www.insa-lyon.fr//sites/all/themes/insa/img/marker.png',
iconSize: [71, 70], // size of the icon
iconAnchor: [31, 63], // point of the icon which will correspond to marker's location
popupAnchor: [0, -62] // point from which the popup should open relative to the iconAnchor
});

L.marker([45.78247, 4.87759], {icon:iconINSA}).addTo(map)
.bindPopup('<h3>INSA de Lyon</h3>20 avenue Albert Einstein<br/>69621 Villeurbanne cedex<br/>T+ 33 (0)4 72 43 83 83<br/><a href="https://www.insa-lyon.fr/">https://www.insa-lyon.fr</a>');

L.marker([46.25174, 5.63190], {icon:iconINSA}).addTo(map)
.bindPopup('<h3>Site de plasturgie de l\'INSA</h3>INSA Bellignat<br/>85 rue Henri Becquerel, 01100 Bellignat<br/>T+ +33 (0)4 72 43 83 83<br/><a href="https://www.insa-lyon.fr/">https://www.insa-lyon.fr</a>');

var LeafIcon = L.Icon.extend({
options: {
shadowUrl: 'https://www.insa-lyon.fr/sites/all/modules/insa_modules/insa_carte/markers/batiments.png',
iconSize: [34, 34], // size of the icon
iconAnchor: [17, 34], // point of the icon which will correspond to marker's location
popupAnchor: [0, -34] // point from which the popup should open relative to the iconAnchor
}
});

var batMarkers = new L.FeatureGroup();
var iconAmphi = new LeafIcon({iconUrl: 'https://www.insa-lyon.fr/sites/all/modules/insa_modules/insa_carte/markers/batiments.png'});
var m301 = L.marker([45.78233299572005, 4.87564787768906], {icon: iconAmphi}).addTo(batMarkers).bindPopup("301 : amphi Seguin");
var m302 = L.marker([45.78308046853913, 4.87600837259372], {icon: iconAmphi}).addTo(batMarkers).bindPopup("302 : St Exupéry");
var m303 = L.marker([45.78245230552723, 4.87521172612985], {icon: iconAmphi}).addTo(batMarkers).bindPopup("303 : Jacquard");
var m304 = L.marker([45.78371017588799, 4.87583952482634], {icon: iconAmphi}).addTo(batMarkers).bindPopup("304 : Perriand");
var m321 = L.marker([45.78305, 4.87662], {icon: iconAmphi}).addTo(batMarkers).bindPopup("321 : Jacqueline Ferrand");

map.on('zoomend', function() {
if (map.getZoom() <15){map.removeLayer(batMarkers);}
else {map.addLayer(batMarkers);}
});

var locVill = new L.LatLng(45.78288, 4.87306);
var locOyo = new L.LatLng(46.25174, 5.63190);

function zoomTo(location) {map.setView(location, 16);}

Back to list