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

IGN API Géoportail Discussion :

Géolocalisation : "a is undefined"


Sujet :

IGN API Géoportail

  1. #1
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mars 2011
    Messages
    7
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2011
    Messages : 7
    Points : 6
    Points
    6
    Par défaut Géolocalisation : "a is undefined"
    Bonjour à tous !

    Je suis entrain de coder une petite fonction me permettant de géolocaliser une adresse simplement, pour l'instant j'ai fait ça :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    Geoportal.GeoRMHandler.getConfig(['xxxxxx'], null,null, {
    			onContractsComplete: Geoportal.Control.LocationUtilityService.Geocode.FormOut= OpenLayers.Class( Geoportal.Control.LocationUtilityService.Geocode, {
    				initialize: function(layer, options) {
    					Geoportal.Control.LocationUtilityService.Geocode.prototype.initialize.apply(this, [options]);
    					alert("ok");
    				}
    			})
    		});
    Et première erreur détectée sur firebug : "a is undefined" dans http://api.ign.fr/geoportail/api/js/...talExtended.js

    Une idée ? Merci !

  2. #2
    Membre averti
    Femme Profil pro
    Consultante SIG
    Inscrit en
    Mars 2011
    Messages
    233
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Consultante SIG

    Informations forums :
    Inscription : Mars 2011
    Messages : 233
    Points : 356
    Points
    356
    Par défaut
    Bonjour,
    le paramètre onContractsComplete a pour valeur le nom d'une méthode callback
    avec onContractsComplete: geocode
    et la méthode geocode définie auparavant, il n'y a plus d'erreur

  3. #3
    Expert confirmé
    Homme Profil pro
    Ingénieur cartographe
    Inscrit en
    Avril 2009
    Messages
    3 173
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Ingénieur cartographe
    Secteur : Service public

    Informations forums :
    Inscription : Avril 2009
    Messages : 3 173
    Points : 4 224
    Points
    4 224
    Par défaut
    La signature du callback (c'est dans la documentation) est :

    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
    /**
     * APIFunction: Geoportal.GeoRMHandler.getContract
     * Build the contract object from the Geoportal API.
     *      Default callback for Geoportal.GeoRMHandler.getConfig() method.
     *
     * Parameters:
     * contract - {Object} information returned by the GeoRM service.
     *      The structure holding the key's contract is :
     *      * service - {String} the GeoRM service that has returned the contract;
     *      * key - {String} the API Key;
     *      * boundingBox - {Object} hold minx, miny, maxx, maxy values
     *      (longitudes, latitudes);
     *      * resources - {Array({Object})} hold all layers available for the
     *      key. Each object holds :
     *          * name - {String} name of layer;
     *          * type - {String} type of service for this layer (WMSC, ...);
     *          * url - {String} service's URL.
     *      * tokenTimeOut - {Integer} number of seconds for GeoRM time to
     *      live.
     *      If contract hold a 'error' property, the key has no contract!
     *
     * Returns:
     * {Object} information needed by the Geoportal API stored in a global
     * variable gGEOPORTALRIGHTSMANAGEMENT. This variable contains
     * a property 'pending' whose value is the number of awaiting contrats.
     * On error, the gGEOPORTALRIGHTSMANAGEMENT.apiKey.length is 0.
     */

    Geoportal.GeoRMHandler.getContract
    est la méthode par défaut appelée en l'absence du paramètre callback

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