Subversion Repositories Sites.obs-saisons.fr

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

<!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>Google Maps JavaScript API Example</title>
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAnm2MSMmwsDuoh7THcVDnlBSAZKnAlQZLiLpbAbKDMtId8LKOVBT1EbOX0DTIKvay9z_AquSgc2_r9A"
      type="text/javascript"></script>
    <script type="text/javascript">

    //<![CDATA[
   var latFr = 47;
   var lonFr = 1.7;

   var latFrMin = 34;
   var latFrMax = 58;
   var lonFrMin = -12;
   var lonFrMax = 15;

    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(latFr, lonFr), 6);
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        map.setMapType(GMapType.G_SATELLITE_MAP);
        //map.addControl(new GSmallZoomControl());
//        window.setTimeout(function() {
        GEvent.addListener(map, "moveend", function() {
          var bounds = map.getBounds();
          var southWest = bounds.getSouthWest();
          var northEast = bounds.getNorthEast();
          if (southWest.lng()<lonFrMin || southWest.lat()<latFrMin
                || northEast.lng()>lonFrMax || northEast.lat()>latFrMax) 
            map.returnToSavedPosition();
          else
            map.savePosition();
        }, 20);

        // Creates a marker at the given point with the given number label
        function createMarker(point, number) {
          var marker = new GMarker(point);
          GEvent.addListener(marker, "click", function() {
            marker.openInfoWindowHtml("Coordonnées : <b>" + number + "</b>");
          });
          return marker;
        }
<? 
include("traitement.php");
?>
        //On définit les puces 
        //var icons = new Array();
<?      for ($i=0; $i<=$nbPuces; $i++) { ?>
          var icon<?= $i ?> = new GIcon();
          icon<?= $i ?>.image = "puces/<?= $i ?>.gif";
          icon<?= $i ?>.shadow = "puces/ombre.png";
          icon<?= $i ?>.iconSize = new GSize(14,14);
          icon<?= $i ?>.shadowSize = new GSize(20,20);
          icon<?= $i ?>.iconAnchor = new GPoint (6,20);
          icon<?= $i ?>.inconWindowAnchor = new GPoint(5,1);
<?      } ?>
        //alert(icons[0].image);
        //on va poser les points des villes
<?
include ("../modules/connect.php");
$req_communes = mysql_query("SELECT DISTINCT STATION_LATITUDE, STATION_LONGITUDE, STATION_ID FROM STATION");
while ($commune = mysql_fetch_row($req_communes)) {
  if (is_numeric($dates[$commune[2]])) {
?>
          var point = new GLatLng(<?= $commune[0] ?>, <?= $commune[1] ?>);
          map.addOverlay(new GMarker(point, icon<?= $dates[$commune[2]] ?>));
<? } } ?>
      } 
    }

    //]]>
    </script>
  </head>
  <body onload="load()" onunload="GUnload()">
    <div id="map" style="width: 600px; height: 600px"></div>
  </body>
</html>