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 26 February 2009 16:45

HF974
Participant occasionnel
Date d'inscription: 12 Feb 2009
Messages: 14

[geoportail+kml] integrer couche kml dans geoportail

bonjour je n'arrive pas a intégrer une couche kml dans le géoportail pouvez vous m'aidez?

J'utilise addlayer pour l'integration d'un kml


Code:

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <script
     src="http://api.ign.fr/api?v=1.0beta3&key=6331982860495322429&instance=maCarte&">
    </script>
    <script type="text/javascript">

    


    
        function initGeoportalMap() {
            //Cette fonction sera exécutée au chargement de la page HTML
            //La carte doit y être créée et paramétrée
            geoportalLoadmaCarte("plancheCartographique","normal","FXX");
        if(maCarte.allowedGeoportalLayers){
    for (var i= 0; i<maCarte.allowedGeoportalLayers.length; i++) {
      
        var overloaded_options= null;
        switch (maCarte.allowedGeoportalLayers[i]) {
   
        case 'ORTHOIMAGERY.ORTHOPHOTOS'    : // ortho-photos
            overloaded_options= {
                                    visibility: false
            };
            break;
              case 'ORTHOIMAGERY.ORTHOPHOTOS'    : // ortho-photos
            overloaded_options= {
                                    visibility:true 
            };
            break;
        
         
        default                            :
            break;
        }
     
    

    }
  
}
    maCarte.addGeoportalLayer(maCarte.allowedGeoportalLayers[1],overloaded_options);
      maCarte.addGeoportalLayer(maCarte.allowedGeoportalLayers[0],overloaded_options);
        maCarte.addGeoportalLayer(maCarte.allowedGeoportalLayers[0],overloaded_options);


  map.getMap.addLayer('KML',  'coucheskml', 'http://andromede.univ-perp.fr/sigweb2008/hoarauf/geoportail/exemkml.kml',
   kml) ;
 




        }
        
    </script>
  </head>
  <body >
    <div id="plancheCartographique" style="width:800px;height:600px;"></div>
  </body>
</html>

Hors ligne

 

#2 Tue 03 March 2009 11:10

HF974
Participant occasionnel
Date d'inscription: 12 Feb 2009
Messages: 14

Re: [geoportail+kml] integrer couche kml dans geoportail

bonjour

j'essaye toujours d'afficher une couche kml dans le geoportail


afin d'ajouter une couche kml  dans interface carto de IGN je dois passé par un proxy php mais la documentation de ign sur utilisation du proxy est difficile pour un débutant et je ne sais pas comment renseigner le proxy

la page de interface carto : http://andromede.univ-perp.fr/sigweb200 … il/geo.php


la page de ma couche kml à rajouter :http://andromede.univ-perp.fr/sigweb2008/hoarauf/geoportail/test.kml

voici le code du proxy : pouvez vous m'aider?

Code:

 
<?php
    // Get the REST call path from the AJAX application
    // Is it a POST or a GET?
    $url = ($_POST['URL']) ? $_POST['URL'] : $_GET['url'];

    // Open the Curl session
    $session = curl_init($url);

    // If it's a POST, put the POST data in the body
    if ($_POST['url']) {
        $postvars = '';
        while ($element = current($_POST)) {
            $postvars .= key($_POST).'='.$element.'&';
            next($_POST);
        }
        curl_setopt ($session, CURLOPT_POST, true);
        curl_setopt ($session, CURLOPT_POSTFIELDS, $postvars);
    }

    // Don't return HTTP headers. Do return the contents of the call
    curl_setopt($session, CURLOPT_HEADER, false);
    curl_setopt($session, CURLOPT_RETURNTRANSFER, true);

    // Possibly go through local proxy
    //curl_setopt($session, CURLOPT_PROXY, 'proxy_host:proxy:port');

    // Make the call
    $xml = curl_exec($session);

    // The web service returns XML. Set the Content-Type appropriately
    header("Content-Type: text/xml");

    echo $xml;
    curl_close($session);
?>

merci

Hors ligne

 

Pied de page des forums

Powered by FluxBB