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

APIs Google Discussion :

BUG de Polyline(qui ne se créé pas) sous IE


Sujet :

APIs Google

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Inscrit en
    Novembre 2008
    Messages
    21
    Détails du profil
    Informations forums :
    Inscription : Novembre 2008
    Messages : 21
    Par défaut BUG de Polyline(qui ne se créé pas) sous IE
    Bonjour j'ai un petit soucis sous Internet explorer (surprenant non ?)

    J'essai d'afficher deux polyline distinctes sur une google map, cela fonctionne sous chrome et firefox mais pas sous IE ...

    Firebug, et debugBar ne me sortent aucune erreur javascript et JSON Validator valide bien mon format JSON .

    Mes markers s'affiche sous IE par contre.

    Voici le code :
    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
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    var map;
    var geocoder;
    var tableauPointsPolyline = [];
    var tableauPointsPolylineFait = [];
     
    $(document).ready(function(){
    	initialize();
    	getWPActu();
    });
     
    /**** GESTION DE GOOGLE MAP ****/
     
    function initialize() {
    	geocoder = new google.maps.Geocoder();
    	var mapOptions = {
    	  zoom: 4,
    	  mapTypeId: google.maps.MapTypeId.ROADMAP
    	};
    	map = new google.maps.Map(document.getElementById("ourTravelActu"),mapOptions);
     
    }
     
    /****************************************/
    /****	AJOUTER UN MARQUEUR  pour previ */
    /****************************************/
     
    function codeAddress(address) {
        geocoder.geocode( { 'address': address}, function(results, status) {
          if (status == google.maps.GeocoderStatus.OK) {
            map.setCenter(results[0].geometry.location);
            var marker = new google.maps.Marker({
                map: map,
    			animation: google.maps.Animation.DROP,
                position: results[0].geometry.location
            });
          } else {
            alert("Geocode was not successful for the following reason: " + status);
          }
        });
    }
     
    function getLat(address) {
        geocoder.geocode( { 'address': address}, function(results, status) {
          if (status == google.maps.GeocoderStatus.OK) {
    		return results[0].geometry.location;
          } 
    	  else {
            alert("Geocode was not successful for the following reason: " + status);
          }
        });
    }
     
    /****************************************/
    /****	Récupération des WP de la BDD   */
    /****************************************/
    function getWPActu(){
    	tableauPointsPolyline = [];
    	tableauPointsPolylineFait = [];
    	var jqxhr = $.getJSON("./ScriptAJAX/getWPActu.php",{date:new Date()}, function() {}).success(function(data) { fillInPoly(data) }).complete(function() { drawPoly();});
     
    }
    /* on charge les deux tableaux pour les polyline, un contenant les passages effectués, l'autre l'ensemble */
    function fillInPoly(wp) {
    	// var wp = eval("(" + wep + ")");
    	for(var i=0;i<wp.length;i++){
    		if(wp[i].etat==1){
    			tableauPointsPolylineFait.push(new Array(wp[i].titre,wp[i].lat,wp[i].lng,wp[i].desc,wp[i].date,wp[i].lien));
    		}
    		tableauPointsPolyline.push(new Array(wp[i].titre,wp[i].lat,wp[i].lng,wp[i].desc,wp[i].date,wp[i].lien));
    	}
    }
     
    /* On dessin les lignes et Marqueurs */
     
    function drawPoly()
    {
     
    	var flightPlanCoordinates = new Array();
    	var flightPlanCoordinatesFait = new Array();
    	var oMarker, oInfo;
    	var i, j, nb = tableauPointsPolyline.length;
    	var nbFait = tableauPointsPolylineFait.length;
    	oInfo = new google.maps.InfoWindow();
    	map = new google.maps.Map(document.getElementById("ourTravelActu"),{
    			'zoom' : 4,
    			'mapTypeId' : google.maps.MapTypeId.ROADMAP
    		});
    	if(nb>0)
    	{
    		for( i = 0; i < nb; i++){
    			flightPlanCoordinates.push(new google.maps.LatLng(tableauPointsPolyline[i][1],tableauPointsPolyline[i][2]));
    			oMarker = new google.maps.Marker({
    			  'position' : new google.maps.LatLng( tableauPointsPolyline[i][1], tableauPointsPolyline[i][2]),
    			  'map' : map,
    			  'title' : tableauPointsPolyline[i][0],
    			  'desc' : tableauPointsPolyline[i][3],
    			  'lien' : tableauPointsPolyline[i][5]
    			});
    			if(tableauPointsPolyline[i][3]!="" || tableauPointsPolyline[i][5]!=""){
    				google.maps.event.addListener( oMarker, 'mouseover', function() {
    				  if(this.lien!="") oInfo.setContent("<div style=height:150px;min-width:400px;text-align:left><h3>"+this.title+"</h3><p>"+this.desc+"</p><a target='_blank' href='"+this.lien+"&k=pays'> Vous souhaitez en savoir plus sur ce pays? Cliquez ici</a></div>");
    				  else oInfo.setContent("<div style=height:150px;min-width:400px;text-align:left><h3>"+this.title+"</h3><p>"+this.desc+"</p></div>");
    				oInfo.open( this.getMap(), this);
    				});
    			}
    			else{
    				google.maps.event.addListener( oMarker, 'mouseover', function() {
    				  oInfo.close();
    				  $(this).css('cursor','default');
    				});
    			}
    		}
    		var flightPath = new google.maps.Polyline({
    			path: flightPlanCoordinates,
    			strokeColor: "#0000FF",
    			strokeOpacity: 0.5,
    			strokeWeight: 1,
    			zIndex : 1
    		});
    		flightPath.setMap(map);
    	}
    	if(nbFait>0){
    		for( j = 0; j < nbFait; j++){
    			flightPlanCoordinatesFait.push(new google.maps.LatLng(tableauPointsPolylineFait[j][1],tableauPointsPolylineFait[j][2]));
    		}
    		var flightPathFait = new google.maps.Polyline({
    			path: flightPlanCoordinatesFait,
    			strokeColor: "#FF0000",
    			strokeOpacity: 1.0,
    			strokeWeight: 4,
    			zIndex : 2
    		});
    		flightPathFait.setMap(map);
    		map.setCenter(new google.maps.LatLng( tableauPointsPolylineFait[nbFait-1][1], tableauPointsPolylineFait[nbFait-1][2]));
    	}
    }
    Les valeurs JSON

    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
     
    [
        {
            "id": "3",
            "lat": "46.227638",
            "lng": "2.213749",
            "date": "02/03/2013",
            "titre": "France",
            "desc": "",
            "adr": "",
            "pays": "France",
            "lien": "",
            "etat": "1"
        },
        {
            "id": "14",
            "lat": "20.593684",
            "lng": "78.96288",
            "date": "02/03/2013",
            "titre": "Inde",
            "desc": "<b>Nord de l'Inde :</b> Du Dimanche 3 mars 2013 au Dimanche 10 mars 2013<br />\n<b>Trajet New Delhi - Katmandou :</b> Du Dimanche 10 mars 2013 au Mardi 12 mars 2013<br />",
            "adr": "",
            "pays": "Inde",
            "lien": "http://homyworld.fr/index.php?p=inde",
            "etat": "1"
        }
    ]
    Et mon code HTML au cas ou :

    Code html : 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
    <?php
    include('conf/conf.php');
    ?>
    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr">
    <head>
    	<title>Homy World</title>
    	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    	<script src="https://maps.googleapis.com/maps/api/js?key=MYKEY&sensor=false"></script>
    	<link rel="stylesheet" href="css/style.css" type="text/css" />
    	<link rel="stylesheet" href="css/slimbox.css" type="text/css" media="screen" />
    	<link rel="stylesheet" href="css/style_calendrier.css" type="text/css" />
    	<link rel="stylesheet" href="css/base.css" type="text/css" />
    	<style type="text/css">
                    #menu .accor_content{
                            display:none;
                    }
            </style>
    	<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
    	<script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
    	<script src="js/mine-jq.js" type="text/javascript"></script>
    	<script src="js/slimbox2.js" type="text/javascript"></script>
    	<script src="js/ourTravelActu.js" type="text/javascript"></script>
    </head>
    <body>
    <div id='header'><a href='index.php'><img alt='HomyWorld' border='0' src='images/logo2.png'></a></div>
    <div id='page'>
    	<div id='page_title'>HomyTravel* </div>
    	<div id="ourTravelActu"></div>
    </div>
    <?php include('menu.html'); ?>
    <div id='footer'>
    <a href='index.php'>
    <div id='accueil'>Accueil</div></a>
    <img id='herbe' src='images/herbe.png' />
     
    <div id='parrain'>
    <a href='index.php?p=parain'>Parrainez un jour</a>
    </div>
    </div>
     
    </body>
    </html>

    Merci pour votre aide !

    Pour le voir en direct c'est ici => http://homyworld.fr/map.php

  2. #2
    Modérateur

    Avatar de NoSmoking
    Homme Profil pro
    Inscrit en
    Janvier 2011
    Messages
    17 217
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Janvier 2011
    Messages : 17 217
    Par défaut
    Bonjour,
    testé sous IE7 et pas vu de problème d'affichage de Polylines manquantes, une rouge "gras" et une bleu "fine".

Discussions similaires

  1. Bug PGPoolII, replication qui ne se fait pas
    Par djaih dans le forum PostgreSQL
    Réponses: 0
    Dernier message: 09/07/2008, 13h41
  2. Probème d'application qui ne se lance pas sous XP
    Par ivanleterrible dans le forum Windows XP
    Réponses: 4
    Dernier message: 26/05/2006, 18h22
  3. onmouseover qui ne se déclenche pas sous IE...
    Par narnou dans le forum Général JavaScript
    Réponses: 7
    Dernier message: 21/03/2006, 17h26
  4. class qui ne s'applique pas sous opéra pour les <tr>?
    Par Death83 dans le forum Balisage (X)HTML et validation W3C
    Réponses: 2
    Dernier message: 02/03/2006, 16h55
  5. [HTML]Image qui ne s'affiche pas sous firefox...
    Par OrangeBud dans le forum Balisage (X)HTML et validation W3C
    Réponses: 3
    Dernier message: 13/10/2004, 13h42

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