defautview = [ defaut_latitude, defaut_longitude]; tmpposition = []; var tmpzoom; var latitude ; var longitude ; var zoom ; // //######################################################################################## // Definition de la MAP var map = L.map('map') .setView(defautview , defautzoom).invalidateSize(true) ; L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { attribution: '© OpenStreetMap contributors' }).addTo(map); //######################################################################################## //////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////// debut point promenade dans le passe deux retraites de bull var coorsField = [{ "type": "Feature", "properties": { "popupContent": "Promenade dans le passé", "url": 'http://encyclopedie-du-college.communaute-emg.net/lencyclopedie/b/belfort/place-de-franche-comte/', "icon": { "iconUrl": 'encyclopédie'} }, "geometry": { "type": "Point", "coordinates": [6.84234, 47.64573] } } ////////////////////////////////////// fin point promenade dans le passe deux retraites de bull ///////////////// ///////////////////////////////////////////////////////////////////////////////// /////////////////////// debut point des metiers varies , { "type": "Feature", "properties": { "popupContent": "Des métiers variés", "url": 'http://encyclopedie-du-college.communaute-emg.net/files/2011/09/métiers-à-Général-électrique.mp3', "icon": { "iconUrl": 'micro'} }, "geometry": { "type": "Point", "coordinates": [6.84401, 47.64264] } } ////////////////////////////////////// fin point des metiers varies /////////////// ///////////// debut point angleterre///////////// , { "type": "Feature", "properties": { "popupContent": "Angleterre", "url": 'http://encyclopedie-du-college.communaute-emg.net/lencyclopedie/abc/angleterre/', "icon": { "iconUrl": 'encyclopedie'} }, "geometry": { "type": "Point", "coordinates": [-1.53809, 53.40953] } } //////////////////debut concert aquatic//////////////////////////// //// , { "type": "Feature", "properties": { "popupContent": "Concert aquatic", "url": 'http://encyclopedie-du-college.communaute-emg.net/files/2011/11/HYDRO-eau-vive-2.mp3', "icon": { "iconUrl": 'micro'} }, "geometry": { "type": "Point", "coordinates": [6.84475, 47.64541] } } //////////////////// fin point concert aquatic ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////// debut point paysage , { "type": "Feature", "properties": { "popupContent": "Paysage", "url": 'http://encyclopedie-du-college.communaute-emg.net/lencyclopedie/b/belfort/portrait-de-technhom-en-mots/etang/', "icon": { "iconUrl": 'photo'} }, "geometry": { "type": "Point", "coordinates": [6.84611, 47.64469] } } ////////////////////////////////// fin point paysage ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////// debut point friche , { "type": "Feature", "properties": { "popupContent": "Friche", "url": 'https://player.vimeo.com/video/131618299', "icon": { "iconUrl": 'video'} }, "geometry": { "type": "Point", "coordinates": [6.84229, 47.64421] } } ////////////////////////////////// fin point friche /////////////////////////////////////////////////////////////////////////////////////////////////////////////// ]; // declaration des fonctions function onEachFeature(feature, layer) { // var popupContent = "

I started out as a GeoJSON " + // feature.geometry.type + ", but now I'm a Leaflet vector!

"; if (feature.properties && feature.properties.popupContent) { var popupContent = feature.properties.popupContent; } //layer.bindPopup(popupContent); } var coorsLayer = L.geoJson(coorsField, { pointToLayer: function (feature, latlng) { return L.marker(latlng, { icon: L.icon({ iconSize: [30, 30], iconAnchor: [16, 37], popupAnchor: [0, -28], iconUrl: 'files/' + feature.properties.icon.iconUrl + '.png' }) }); }, onEachFeature: onEachFeature }).addTo(map); coorsLayer.on('click', function(e) { clicfeature(); window.parent.location.href = e.layer.feature.properties.url; }); coorsLayer.on('mouseover', function(e) { //open popup; var popup = L.popup({offset: new L.Point(0, - 50)}) .setLatLng(e.latlng) //(assuming e.latlng returns the coordinates of the event) .setContent(e.layer.feature.properties.popupContent) .openOn(map); }); coorsLayer.on('mouseout', function(e) { //open popup; map.closePopup(); }); //######################################################################################## // alert("readcookie : " + readCookie("position")); function onMapClick(e) { var popup2 = L.popup() .setLatLng(e.latlng) .setContent("Vous avez cliqué sur " + e.latlng.toString() + "Zoom = " + map.getZoom()) .openOn(map); } map.on('click', onMapClick); myLayer.on('click', function(e) { clicfeature(); window.parent.location.href = e.layer.feature.properties.url; }); function clicfeature (){ /* latitude = map.getCenter().lat; longitude = map.getCenter().lng; zoom = map.getZoom(); createCookie("positionmonde",[latitude,longitude] ,3) createCookie("zoommonde",zoom ,3) */ $("html, body").animate({ scrollTop: 0 }, 400); } function center_init_map(){ map.setView([ defaut_latitude, defaut_longitude], init_zoom); }