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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
| <?php
mysql_connect("", "", "");
mysql_select_db("");
$reponse = mysql_query("SELECT Latitude,Longitude FROM T_Gps")
$data = array();
while ($donnees = mysql_fetch_array($reponse)){
$data[] = $donnees;
}
mysql_close();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>carte d'essai</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function load() {
if (GBrowserIsCompatible()) {
function createMarker(point, number) {
var marker = new GMarker(point,icon);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowTabsHtml(infoTabs);
});
return marker;
}
var infoTabs = [
new GInfoWindowTab(" info1", " "),
new GInfoWindowTab(" info2", " ")
];
//création d'une carte nommé "map"
var map = new GMap2(document.getElementById("map"));
GEvent.addListener(map, "moveend", function() {
var center = map.getCenter();
});
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(45.44 , 4.395), Cool;
var icon = new GIcon();
icon.image = "http://images.google.fr/images?q=tbn:gS51abIJ6eysoM:http://rgfrance0.tripod.com/sitebuildercontent/sitebuilderpictures/flag.jpg";
icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
icon.iconSize = new GSize(23, 23);
icon.shadowSize = new GSize(22, 20);
icon.iconAnchor = new GPoint(6, 20);
icon.infoWindowAnchor = new GPoint(5, 1);
<?php foreach ($data as $donnees): ?>
var point = new GLatLng('<?php echo $donnees['Latitude']; ?>','<?php echo $donnees['Longitude'] ; ?>')
map.addOverlay(createMarker(point ,1));
<?php endforeach; ?>
marker.openInfoWindowTabsHtml(infoTabs);
} // fin if (GBrowserIsCompatible())
} // fin load()
//]]>
</script>
</head>
<body onload="load()" onunload="GUnload()">
<div id="map" style="width: 500px; height: 500px"></div>
</body>
</html> |
Partager