http://www.journaldunet.com/developpeur/tutoriel/dht/061222-google-maps-api/5.shtml Lancer l'impression





Utiliser l'API Google Maps > Utiliser XML, les sources

Précédente Aller plus loin... 
 

Le fichier XML que nous utilisons, qui doit impérativement être encodé en UTF-8 :

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <markers>
  3.   <marker lat="48.9" lng="2.3" info="Premier endroit"   details="Quelques informations supplémentaires" />
  4.   <marker lat="49"   lng="3"   info="Deuxième endroit"  details="Quelques informations supplémentaires" />
  5.   <marker lat="48.2" lng="2.7" info="Troisième endroit" details="Quelques informations supplémentaires" />
  6.   <marker lat="48.5" lng="2.4" info="Quatrieme endroit" details="Quelques informations supplémentaires" />
  7. </markers>

Notre fichier XHTML :

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2.     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4.   <head>
  5.     <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
  6.     <title>Utilisation de XML</title>
  7.     <script src="http://maps.google.com/maps?file=api&amp;v=2"
  8.             type="text/javascript"></script>
  9.     <script type="text/javascript">
  10.     //<![CDATA[
  11.  
  12.     function load() );
  13.       return marker;
  14.       }
  15.  
  16.         GDownloadUrl("donnees.xml", function(data)
  17.         });
  18.       }
  19.     }
  20.  
  21.     //]]>
  22.     </script>
  23.   </head>
  24.  
  25.   <body onload="load()" onunload="GUnload()">
  26.     <div id="map" style="width: 600px; height: 200px"></div>
  27.   </body>
  28. </html>
Exemple de code HTML pour les infobulles :
  1. <marker lat="48.2" lng="2.7" info="Troisième endroit" details="Grâce à HTML, nous pouvons utiliser des images : &lt;br/&gt; &lt;img src='http://www.google.com/intl/fr_fr/images/maps_results_logo.gif'/&gt; " />
Précédente Retour au sommaire Page suivante 
Copyright 2006 Benchmark Group - 69-71 avenue Pierre Grenier, 92517 Boulogne Billancourt Cedex, FRANCE
Lancer l'impression