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 :

Recherche exemple d'utilisation de Geoportal.Layer.Aggregate


Sujet :

IGN API Géoportail

  1. #1
    Membre à l'essai
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    19
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2010
    Messages : 19
    Points : 21
    Points
    21
    Par défaut Recherche exemple d'utilisation de Geoportal.Layer.Aggregate
    Bonjour,

    Je recherche un (ou des) exemple(s) d'utilisation de Geoportal.Layer.Aggregate (même si c'est encore expérimental).
    Plus précisément, comment utilise-t-on la hashTable d'options?

    Mon but est de regrouper plusieurs couches WFS afin de pouvoir afficher dans un GridPanel des attributs de ces couches.

    Peut-être y a-t-il une autre manière de le faire?

    Merci d'avance.
    spatman

  2. #2
    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
    Basé sur les couches risques naturels du MEEDDM
    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
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
            viewer.getMap().addLayer(
                new Geoportal.Layer.Aggregate(
                    'cartorisque.avalanches',
                    [
                        new OpenLayers.Layer.WMS(
                            'zont.wms.name',
                            "http://cartorisque.prim.net/wms/france",
                            {
                                layers:'zont_alp,zont_pyr',
                                format:'image/gif',
                                transparent:true
                            },
                            {
                                singleTile:true,
                                projection: "EPSG:4326",
                                // maxExtent expressed in EPSG:4326 :
                                maxExtent: new OpenLayers.Bounds(-5.50054,41.3202,10.798,51.0896),
                                minZoomLevel:5,
                                maxZoomLevel:15,
                                opacity:0.5
                            }
                        ),
                        new OpenLayers.Layer.WMS(
                            'zonpi.wms.name',
                            "http://cartorisque.prim.net/wms/france",
                            {
                                layers:'zonpi_alp,zonpi_pyr',
                                format:'image/gif',
                                transparent:true
                            },
                            {
                                singleTile:true,
                                projection: "EPSG:4326",
                                // maxExtent expressed in EPSG:4326 :
                                maxExtent: new OpenLayers.Bounds(-5.50054,41.3202,10.798,51.0896),
                                minZoomLevel:5,
                                maxZoomLevel:15,
                                opacity:0.5
                            }
                        ),
                        new OpenLayers.Layer.WMS(
                            'front.wms.name',
                            "http://cartorisque.prim.net/wms/france",
                            {
                                layers:'front_alp,front_pyr',
                                format:'image/gif',
                                transparent:true
                            },
                            {
                                singleTile:true,
                                projection: "EPSG:4326",
                                // maxExtent expressed in EPSG:4326 :
                                maxExtent: new OpenLayers.Bounds(-5.50054,41.3202,10.798,51.0896),
                                minZoomLevel:8,
                                maxZoomLevel:15,
                                opacity:1.0
                            }
                        ),
                        new OpenLayers.Layer.WMS(
                            'linpi.wms.name',
                            "http://cartorisque.prim.net/wms/france",
                            {
                                layers:'linpi_alp,linpi_pyr',
                                format:'image/gif',
                                transparent:true
                            },
                            {
                                singleTile:true,
                                projection: "EPSG:4326",
                                // maxExtent expressed in EPSG:4326 :
                                maxExtent: new OpenLayers.Bounds(-5.50054,41.3202,10.798,51.0896),
                                minZoomLevel:10,
                                maxZoomLevel:15,
                                opacity:1.0
                            }
                        ),
                        new OpenLayers.Layer.WMS(
                            'label.wms.name',
                            "http://cartorisque.prim.net/wms/france",
                            {
                                layers:'Num_emprise_Alpes,Num_emprise_Pyrenees',
                                format:'image/gif',
                                transparent:true
                            },
                            {
                                singleTile:true,
                                projection: "EPSG:4326",
                                // maxExtent expressed in EPSG:4326 :
                                maxExtent: new OpenLayers.Bounds(-5.50054,41.3202,10.798,51.0896),
                                minZoomLevel:13,
                                maxZoomLevel:15,
                                opacity:1.0
                            }
                        )
                    ],
    // propriétés de l'agrégat :
                    {
                        visibility: false,
                        originators:[
                            {
                                logo:'meeddat',
                                pictureUrl:'http://www.ign.fr/images/logo_meeddat.gif',
                                url:'http://www.developpement-durable.gouv.fr/'
                            },
                            {
                                logo:'cemagref',
                                url:'http://www.cemagref.fr/'
                            }
                        ]
                    }
                )
            );
    L'agrégat est donc une somme de couches (invisibles dans le gestionnaire de couches), mais qui ont leur comportement propre (échelles min-max).

  3. #3
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Octobre 2009
    Messages
    27
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2009
    Messages : 27
    Points : 35
    Points
    35
    Par défaut


    Merci !

  4. #4
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Octobre 2009
    Messages
    27
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2009
    Messages : 27
    Points : 35
    Points
    35
    Par défaut
    Par contre si on désactive la couche "agrégeante" (case à cocher) dans le selecteur de couches, les couches agrégées devraient disparaître de la carte non ? C'est pas le cas chez moi

    La case à cocher n'a aucun effet...

  5. #5
    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
    Citation Envoyé par Florent13 Voir le message
    Par contre si on désactive la couche "agrégeante" (case à cocher) dans le selecteur de couches, les couches agrégées devraient disparaître de la carte non ? C'est pas le cas chez moi
    As-tu une page web que je regarde comment tu as déclaré ton aggrégat ?

  6. #6
    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
    Peux-tu ajouter ceci à ton code (au début de la méthode type initGeoportalMap()) ?

    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
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
        Geoportal.Layer.Aggregate.prototype.setVisibility= function(visibility) {
            if (visibility != this.visibility) {
                this.visibility= visibility;
                Geoportal.Layer.prototype.display.apply(this,arguments);
                if (this.layers && this.map!=null) {
                    var layer, lproj;
                    for (var i= 0, len= this.layers.length; i<len; i++) {
                        layer= this.layers[i];
                        if (layer.isBaseLayer) { continue; }
                        if (layer.territory!==undefined && this.map.baseLayer.territory!==undefined) {
                            if (layer.territory==this.map.baseLayer.territory) {
                                if (visibility) {
                                    layer.setVisibility(layer.calculateInRange());
                                } else {
                                    layer.setVisibility(false);
                                }
                            }
                            // layer.visibility===false : not current territory
                            continue;
                        }
                        lproj= layer.getNativeProjection();
                        if (!lproj) { continue; }
                        if (!(lproj.equals(this.map.baseLayer.nativeProjection) ||
                              (lproj.getProjName()=='longlat' &&
                               lproj.isCompatibleWith(this.map.baseLayer.getNativeProjection())))) {
                            // layer.visibility===false : not compatible with current map's projection
                            continue;
                        }
                        if (this.map.baseLayer.maxExtent.intersectsBounds(layer.restrictedExtent || layer.maxExtent)) {
                            if (visibility) {
                                layer.setVisibility(layer.calculateInRange());
                            } else {
                                layer.setVisibility(false);
                            }
                        }
                        // layer.visibility===false : not in current extent
                    }
                }
                if (this.map != null) {
                    this.map.events.triggerEvent("changelayer", {
                        layer: this,
                        property: "visibility"
                    });
                }
                this.events.triggerEvent("visibilitychanged");
            }
        };
    Il faut non seulement tester que le on/off allume/éteint les agrégats, mais aussi que le changement de zooms (hors plage autorisée éteint aussi complètement l'agrégat).

  7. #7
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Octobre 2009
    Messages
    27
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2009
    Messages : 27
    Points : 35
    Points
    35
    Par défaut


    Ca le fait

  8. #8
    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
    Citation Envoyé par Florent13 Voir le message


    Ca le fait
    Y compris les changements d'échelles (sans cocher/décocher) ?

  9. #9
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Octobre 2009
    Messages
    27
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2009
    Messages : 27
    Points : 35
    Points
    35
    Par défaut
    Oui j'ai testé un peu rapidement : ça ne marche pas en vue world : la couche reste activée.

  10. #10
    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
    Citation Envoyé par Florent13 Voir le message
    Oui j'ai testé un peu rapidement : ça ne marche pas en vue world : la couche reste activée.
    Certes, mais est-ce que la couche l'interdit ?
    Si les données sont bien placées, c'est bon, sinon problème ...

    Il faudrait jouer sur les minZoomLevel de toutes les sous-couches de l'agrégat, surtout quand celui-ci est composé de couches vecteur qui se reprojettent à toutes les échelles ... y compris monde !

  11. #11
    Membre à l'essai
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    19
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2010
    Messages : 19
    Points : 21
    Points
    21
    Par défaut
    Citation Envoyé par dgrichard Voir le message
    Il faudrait jouer sur les minZoomLevel de toutes les sous-couches de l'agrégat
    ça marche bien en gérant les zooms de chaque couche.
    Encore merci!

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Api Javascript : Pb Geoportal.Layer.Aggregate version 2.0.2
    Par titam11 dans le forum IGN API Géoportail
    Réponses: 9
    Dernier message: 25/10/2012, 15h44
  2. recherche exemples de "méthodes de management"
    Par ouckileou dans le forum Emploi
    Réponses: 7
    Dernier message: 03/03/2005, 16h01
  3. [NetBeans RCP] Recherche Exemples
    Par mbonnetaud dans le forum NetBeans
    Réponses: 2
    Dernier message: 27/02/2005, 22h58
  4. Recherche des exemple d'utilisation
    Par lemme dans le forum Merise
    Réponses: 2
    Dernier message: 26/02/2003, 13h00
  5. recherche exemple simple pour corba en c++
    Par Pinggui dans le forum CORBA
    Réponses: 4
    Dernier message: 06/05/2002, 11h29

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