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é ?

#1 Wed 09 June 2010 21:00

tiolebucheron
Participant actif
Lieu: Rouen
Date d'inscription: 26 Mar 2006
Messages: 147

[MAPFISH] mapfish.widgets.LayerTree & Expression

Bonjour

Je suis à la recherche de l'option pour afficher la légende des classes Expressions contenu dans le Mapfile dans le mapfish.widgets.LayerTree

J'ai essayé

Code:

tree = new mapfish.widgets.LayerTree({
        map: map,
        el: 'pnl_tree',
        model: model,
        showWmsLegend: true,
        plugins: [
            mapfish.widgets.LayerTree.createContextualMenuPlugin(['opacitySlideDirect'])
      ]
  });
    tree.render();

Avec le  Mapfile suivant

Code:

    LAYER
        NAME "statut"
        STATUS ON
        TYPE POLYGON
        CONNECTIONTYPE postgis
        CONNECTION xx
        DATA xx
        CLASS
            NAME "Foret_Public"
            EXPRESSION ("[pf_code]" eq "1" or "[pf_code]" eq "2")
            TEMPLATE "ttt"
            STYLE
                COLOR 153 153 153
            END
        END #CLASS
        CLASS
            NAME "Foret_Privee"
            EXPRESSION ("[pf_code]" eq "4")
            TEMPLATE "ttt"
            STYLE
                COLOR 0 153 0
            END
        END #CLASS
        METADATA
            "id_attribute_string" "all"
            "wms_title" "Statut orêt IFN"
            "wms_srs" "EPSG:27572"
            "wms_featureid" "ogc_fid"
            "wms_include_items" "all"
        END
    END

Cela ne fonctionne pas sad
Merci de votre aide Tio

Dernière modification par tiolebucheron (Wed 09 June 2010 21:01)

Hors ligne

 

#2 Fri 11 June 2010 08:43

tiolebucheron
Participant actif
Lieu: Rouen
Date d'inscription: 26 Mar 2006
Messages: 147

Re: [MAPFISH] mapfish.widgets.LayerTree & Expression

Bonjour

J'ai utilisé le GeoExt.LegendPanel pour obtenir quelque chose de similaire.

Il faut un bug avec le tilecache http://www.geoext.org/pipermail/users/2 … 00813.html

Thanks Ryan...

But I found other solution...
I edited the setUrl method from LegendImage.Js...

Before
setUrl: function(url) {
        this.url = url;
        var el = this.getEl();
        if (el) {
            el.un("error", this.onImageLoadError, this);
            el.on("error", this.onImageLoadError, this, {single: true});
            el.dom.src = url;
        }
    },


My modification
setUrl: function(url) {
        this.url = url.replace("tilecache.py?","
http://localhost/cgi-bin/mapserv.exe?map=Map.map&");

        var el = this.getEl();
        if (el) {
            el.un("error", this.onImageLoadError, this);
            el.on("error", this.onImageLoadError, this, {single: true});
            el.dom.src = this.url;
        }
    },


Worked fine!

Thanks


Tio

Hors ligne

 

Pied de page des forums

Powered by FluxBB