IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaScript Discussion :

[google map] code n'affiche pas les marqueurs voulus


Sujet :

JavaScript

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Mai 2005
    Messages
    129
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2005
    Messages : 129
    Points : 47
    Points
    47
    Par défaut [google map] code n'affiche pas les marqueurs voulus
    Bonjour,

    j'ai fait un petit script google map pour afficher une carte avec 3 points :
    - 1 point d'arrivée (point0)
    - 2 autrees points (point1 et point2)
    Le code est écrit pour que le point d'arrivée soit affiché avec une icone différente des points 1 et 2.
    Seul probleme, le script n'affiche que le point d'arrivée et pas les 2 autres points, alors que j'ai suivi la doc sur http://www.google.fr/apis/maps/documentation/

    Mon code est en dessous
    Si jamais vous voyez le probleme...merci !



    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    72
    73
    74
    75
    76
    77
    78
    79
    80
    <html>
    <head>
        <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAal_cd43vOKPQhNkPDkwHgBQSXE4ITa1YzwIbIoQt-CisjCLm8xTJhtTXHvXoMcij_eu3bNbEGnk_PA" type="text/javascript"></script>
    </head>
    <body>
     
    <?php 
    $lat0=48.847043;
    $long0=2.295967;
    $lat1=48.831764;
    $long1=2.302745;
    $lat2=48.870227;
    $long2=2.297948;
    ?>
     
     
        <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
     
      <body onunload="GUnload()">
     
     
        <div id="map" style="width: 550px; height: 450px"></div>
     
        <noscript><b>JavaScript must be enabled in order for you to use Google Maps.</b> 
          However, it seems JavaScript is either disabled or not supported by your browser. 
          To view Google Maps, enable JavaScript by changing your browser options, and then 
          try again.
        </noscript>
     
     
        <script type="text/javascript">
        //<![CDATA[
     
        if (GBrowserIsCompatible()) { 
     
    var map = new GMap2(document.getElementById("map"));
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    map.setCenter(new GLatLng(<?php echo "$lat0,$long0" ; ?>), 13);
    // 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("Marker #<b>" + number + "</b>");
     });
     return marker;
     }
     
     	  //Création d´une icone personnalisé.
    	  var icone = new GIcon();
    	  icone.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
    	  icone.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
    	  icone.iconSize = new GSize(12, 20);
    	  icone.shadowSize = new GSize(22, 20);
    	  icone.iconAnchor = new GPoint(6, 20);
    	  icone.infoWindowAnchor = new GPoint(5, 1);
     
    	   var point0 = new GLatLng(<?php echo "$lat0,$long0" ; ?>);
     
    	  // marqueur du point d'arrivée
    	  var marqueur_arrivee = new GMarker(point0, icone);  
          map.addOverlay(marqueur_arrivee);
    	  marqueur.openInfoWindowHtml("<b>Votre lieu d'arrivee</b>");
     
     // Add 10 markers to the map at random locations
     
     var point1 = new GLatLng(<?php echo "$lat1,$long1" ; ?>);  map.addOverlay(createMarker(point1, 1));	
     var point2 = new GLatLng(<?php echo "$lat2,$long2" ; ?>);  map.addOverlay(createMarker(point2, 2));	
    	}
        // display a warning if the browser was not compatible
        else {
          alert("Désolé, Google Maps API n'est pas compatible avec votre navigateur");
        }
     
        //]]>
        </script>
     
    <!-- --End Map Search Solution Wizard Generated Code-- -->
     
    </body>
    </html>

  2. #2
    Membre du Club
    Profil pro
    Inscrit en
    Mai 2005
    Messages
    129
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2005
    Messages : 129
    Points : 47
    Points
    47
    Par défaut
    pas d'idées??

Discussions similaires

  1. pointeur de google map ne s'affiche pas
    Par Invité dans le forum Langage
    Réponses: 15
    Dernier message: 07/09/2013, 18h46
  2. Ma carte Google Maps ne s'affiche pas
    Par developpCathy dans le forum API standards et tierces
    Réponses: 10
    Dernier message: 29/02/2012, 22h29
  3. [Google Maps] Carte Google Maps ne s'affiche pas entièrement
    Par Kentin64 dans le forum APIs Google
    Réponses: 2
    Dernier message: 19/08/2011, 10h19
  4. Réponses: 1
    Dernier message: 08/12/2006, 10h16
  5. [CR9 et VB6] n'affiche pas les nouvelles donnée
    Par moumoule17 dans le forum SDK
    Réponses: 3
    Dernier message: 22/04/2005, 12h03

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo