Voila mon problème je veux afficher plusieurs points sur une carte (ces points correspondent à des magnitudes de séismes) en fonctions des coordonnées (latitude, longitude)
ces coordonnées sont dans une base de donnée mysql
J'ai trouvé un code pour faire à peu près cela ,mais je n'ai pas su l'adapter à mon problème.
Je voudrais qu'en faisant une recherche dans un formulaire (chercher les magnitude selon certains critères) j'aie le résultat qui s'affiche sur une carte géographique.Voici le code que j'ai trouvé.
Pourriez vous m'aider c'est assez urgent,merci d'avance.
<!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">
<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>
<head>
<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), 8);
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);
var point = new GLatLng('<?php echo $donnees['lat']; ?>','<?php echo $donnees['lon'] ; ?>')
map.addOverlay(createMarker(point ,1));
marker.openInfoWindowTabsHtml(infoTabs);
}
}
//]]>
</script>
<?php
mysql_connect("localhost", "root", "");
mysql_select_db("test4");
//on recupere la latitude longitude nom de la structure
$reponse = mysql_query("SELECT lat,lon FROM seisme");
while ($donnees = mysql_fetch_array($reponse)){
}
mysql_close();
?>
</head>
<body onload="load()" onunload="GUnload()">
<div id="map" style="width: 500px; height: 500px"></div>
</body>
</html>