Nous utilisons des cookies pour vous garantir la meilleure expérience sur notre site. Si vous continuez à utiliser ce dernier, nous considèrerons que vous acceptez l'utilisation des cookies. J'ai compris ! ou En savoir plus !.
banniere

Le portail francophone de la géomatique


Toujours pas inscrit ? Mot de passe oublié ?
Nom d'utilisateur    Mot de passe              Toujours pas inscrit ?   Mot de passe oublié ?

Annonce

Printemps des cartes 2024

#1 Thu 29 January 2009 09:37

didier6526
Juste Inscrit !
Date d'inscription: 29 Jan 2009
Messages: 1

API google earth et google map superposés: recherche et survol ?

bonjour à tous
c'est ma première visite chez vous
J'ai créé une page http://mycomenius.free.fr/google_earth.html  que je souhaite améliorer.

dans la page suivante j'ai les fonctionnalités de base que je recherche sur une page google earth.
http://mycomenius.free.fr/sauvegarde7_r … uceur.html
comment , à partir de ce code peux t-on ajouter les couches de google map comme dans la page suivante tout en conservant la fonction de recherche et de survol de la terre?
http://mycomenius.free.fr/sauvegarde15_ … earth.html
merci d'avance à tous .
didier
Les codes des 2 pages sont:

Code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="ltr" lang="notutf8-fr">
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
<title>Recherche et survol en douceur</title>
<meta name="title" content="Api google earth orientation">
<style type="text/css"></style>
<script src="http://www.google.com/jsapi?key=ABQIAAAAZDoIW1CMRgES87ULstW6KhQYkGc0-09RTj_iHO3dvAccOVoauhTcgHvXBNbtbg0-IsBSlT4YZtICqg"></script>

<script>
google.load("earth", "1");
google.load("maps", "2.99");  // For JS geocoder

function init() {
  geocoder = new GClientGeocoder();
  google.earth.createInstance("map3d", initCallback, failureCallback);
  google.earth.createInstance("map3d", initCB, failureCB);
}

function initCallback(object) {
  ge = object;
  ge.getWindow().setVisibility(true);
   var cam = ge.getView().copyAsCamera(ge.ALTITUDE_ABSOLUTE);
  cam.setAltitude(30000000);
  ge.getView().setAbstractView(cam);
  ge.getNavigationControl().setVisibility(ge.VISIBILITY_SHOW);
  document.getElementById('geplugin_version').innerHTML = ge.getPluginVersion();

}

function failureCallback(object) {
}
function submitLocation() {
  var address = document.getElementById('address').value;
  geocoder.getLatLng(
    address, 
    function(point) {
      if (point && ge != null) {
        var la = ge.createLookAt('');     
        la.set(point.y, point.x, 10, ge.ALTITUDE_RELATIVE_TO_GROUND, 
               0, 60, 4000);
        ge.getView().setAbstractView(la);

      }
    }
  );
}
</script>
  </head>
  
    <body onload='init()' id='body' bgcolor="#000000">   
    <div>
      <form name='searchform' id='searchform' action='javascript:submitLocation();void(0);'>
      <input type=text size=30 id='address'></input>
      <input type=submit value='Go !'>
      </form>    
      </div>  
      
     <center>
          <div id='map3d_container'
          style='border: 0px solid silver; height: 650px;'>
             <div id='map3d' style='height: 100%;'>
             </div>
          </div>        
     </center> 
     </body>
</html>

et

Code:

<!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"
      xmlns:v="urn:schemas-microsoft-com:vml">
  <head>
    <title>Using Google Earth API with the Maps API</title>

    <script src="http://maps.google.com/maps?file=api&v=2.x&key=ABQIAAAAZDoIW1CMRgES87ULstW6KhQYkGc0-09RTj_iHO3dvAccOVoauhTcgHvXBNbtbg0-IsBSlT4YZtICqg"
            type="text/javascript"></script>
    <script type="text/javascript">
    function initialize() {
      var map = new GMap2(document.getElementById("map"));
      map.setCenter(new GLatLng(37.4419, -122.1419), 13);
 // commandes pour relief
        map.addMapType(G_PHYSICAL_MAP);     
      map.addMapType(G_SATELLITE_3D_MAP);
      map.addControl(new GHierarchicalMapTypeControl());
             
      // commande module déplacement orientation carte
      map.addControl(new GLargeMapControl());
     // commande pour démarrer sur google earth
     map.setMapType(G_SATELLITE_3D_MAP);
     
     // commandes pour bouton multi commandes en lève ces 3 lignes pour avoir la rangée de boutons et place du bouton
       map.addControl(new GMenuMapTypeControl(), new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(0,0)));
        map.addOverlay(marker); 
     
     // Obtain a pointer to the Google Earth instance attached to
     // your map.
      map.getEarthInstance(getEarthInstanceCB);
    }
    
    var ge;
    function getEarthInstanceCB(object) {
      ge = object;
      // You can now manipulate ge using the full Google Earth API.
    }
    
    </script>

  </head>
  <body onload="initialize()" onunload="GUnload">
    <div id="map" class="map" style="width:900px;height:500px"></div>
  </body>
</html>

Hors ligne

 

Pied de page des forums

Powered by FluxBB