ExpoActes : afficher la position d’une commune


actes/localite.php

Modif pour utiliser openstreetmap au lieu de Google Maps

[.....]
zone_menu(0,$userlevel);

echo '<div id="col_main">'."\n";
echo '<h2>Commune/Paroisse : '.$localite.'</h2>';
echo '<link rel="stylesheet" href="/leaflet/leaflet.css" />';
echo '<div id="map"></div>';
echo '<script src="/leaflet/leaflet.js" ></script>';
echo '<link rel="stylesheet" href="/leaflet/leaflet.fullscreen.css" />';
echo '<script src="/leaflet/Leaflet.fullscreen.min.js"></script>';
echo '<script type="text/javascript">';
echo '  var lat = '.$lat.';';
echo '  var lon = '.$lon.';';
echo '  var macarte = null;';
echo '  function initMap() {';
echo '          var iconBase = "/actes/img/pin_eye.png";';
echo "          macarte = L.map('map').setView([lat, lon], 13);";
echo '          L.tileLayer("https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png", {';
echo '                  attribution: \'données © <a href="//osm.org/copyright">OpenStreetMap</a>/ODbL - rendu <a href="//openstreetmap.fr">OSM France</a>\',';
echo '                  minZoom: 1,';
echo '                  maxZoom: 20';
echo '          }).addTo(macarte);';
echo '          var myIcon = L.icon({';
echo '                  iconUrl: iconBase ,';
echo '                  iconSize: [50, 80],';
echo '                  iconAnchor: [50, 80],';
echo '                  popupAnchor: [-25, -80],';
echo '          });';
echo '          var marker = L.marker([lat, lon],{ icon: myIcon }).addTo(macarte);';
echo '          macarte.addControl(new L.Control.Fullscreen({';
echo '                  title: {';
echo "                          'false': 'Passer en plein écran',";
echo "                          'true': 'Sortir du plein écran'";
echo '                  }';
echo '         }));';

echo '  }';
echo 'window.onload = function(){';
echo '          initMap(); ';
echo '};';
echo '</script>';
echo '<style type="text/css">';
echo '  #map{ ';
echo '          height:400px;';
echo '  }';
echo '</style>';


echo '</div>';
echo "<center>";

[........]