1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| <script type="text/javascript">
function initialize() {
map = new google.maps.Map(document.getElementById("map_canvas"), {
zoom: 9,
center: new google.maps.LatLng(48.858565, 4.347198),
mapTypeId: google.maps.MapTypeId.HYBRID
});
}
if (navigator.geolocation)
var watchId = navigator.geolocation.watchPosition(successCallback,
null,
{enableHighAccuracy:true});
else
alert("Votre navigateur ne prend pas en compte la géolocalisation HTML5");
function successCallback(position){
map.panTo(new google.maps.LatLng(position.coords.latitude, position.coords.longitude));
var marker = new google.maps.Marker({
position: new google.maps.LatLng(position.coords.latitude, position.coords.longitude),
map: map
});
}
var bounds = new google.maps.LatLngBounds();
function addMarker(lat, lng) {
var pt = new google.maps.LatLng(lat, lng);
bounds.extend(pt);
var marker = new google.maps.Marker({
position: pt,
map: map
});
}
<?php
$req = $bdd->prepare('SELECT * FROM event ');
$req->execute();
while ($row = $req->fetch()){
$lat=$row['latitude'];
$lon=$row['longitude'];
echo ("addMarker($lat, $lon)\n");
}
?>
</script>
</head>
<body onload="initialize()" > |
Partager