2010-12-08 8 views

Répondre

1

pour la mise en œuvre emplacement multiples sur la carte Google vous devez d'abord créer un fichier kml exemple: -

<?xml version="1.0" encoding="UTF-8"?> 
<kml xmlns="http://www.opengis.net/kml/2.2"> 
<Document> 
    <Placemark> 
    <name>Ottawa</name> 
    <description>Ottawa office</description> 
    <Point> 
    <coordinates>-90.86948943473118,48.25450093195546,0</coordinates> 
    </Point> 
    </Placemark> 
    <Placemark> 
    <name>Battel Creek</name> 
    <description>Battel Creek</description> 
    <Point> 
    <coordinates>-85.1220703125,42.35042512243457,0</coordinates> 
    </Point> 
    </Placemark> 

    </Document> 
</kml> 

enregistrer ce fichier sur un serveur (extension doit être KML) et définir ce chemin dans le code ci-dessous: -

public void invokeGMaps() { 

     int mh = CodeModuleManager.getModuleHandle("GoogleMaps"); 
      if (mh == 0) { 
      try { 
      throw new ApplicationManagerException(
       "GoogleMaps isn't installed"); 
      } catch (ApplicationManagerException e) { 
      System.out.println(e.getMessage()); 
      } 
      } 
      String[] args = { };//PUT THE SAVED FILE URL OVER HERE IN DOUBLE QUOTES 
      ApplicationDescriptor ad = CodeModuleManager 
      .getApplicationDescriptors(mh)[0]; 
      ApplicationDescriptor ad2 = new ApplicationDescriptor(ad, args); 
      try { 
      ApplicationManager.getApplicationManager() 
      .runApplication(ad2, true); 
      } catch (ApplicationManagerException e) { 
      System.out.println(e.getMessage()); 
      } 
     } 

Vous devez installer google map avant d'implémenter ces codes. vous pouvez télécharger google map à partir d'ici: - m.google.com/maps

Questions connexes