[Users] How to create legend panel using OpenLayers.Layer.MapServer layer...

stela anders stelaanders at gmail.com
Thu Jan 7 13:37:44 CET 2010


Hello Andreas...

All sublayers is with status ON, they are draw on map, but in my legend I
got ONLY "Layer1" label printed...
My layers:
               OpenLayers.Layer.WMS("Layer1",
                mycgi, {
                    map: mymapfile,
                    layers: ['Sublayer11','Sublayer12', 'Sublayer13'],
                    format: "image/png",
                    transparent: "true"
                }, {
                    isBaseLayer: true,
                    visibility: true
                }),

               OpenLayers.Layer.WMS("Layer2",
                mycgi, {
                    map: mymapfile,
                    layers: ['Sublayer21','Sublayer22', 'Sublayer23'],
                    format: "image/png",
                    transparent: "true"
                }, {
                    isBaseLayer: false,
                    displayInLayerSwitcher: false,
                    visibility: true
                }),

So, What is your suggestion in building a legend to Map with GeoExt
sublayers? I need all sublayers appears on my legend (each one has different
images...)

Thank you!

Stella


2010/1/6 Andreas Hocevar <ahocevar at opengeo.org>

> On 2010-01-06 18:34, stela anders wrote:
> > Thanks again...
> > I have 3 layers, each one has several sublayers.... :
> > OpenLayers.Layer.WMS("Layer1", ...
> > OpenLayers.Layer.WMS("Layer2",
> > OpenLayers.Layer.WMS("Layer3",
>
>
> GeoExt/OpenLayers does not know about your sublayers in this case.
>
> > But my legend only prints one Label ("Layer1") .... None imagens at
> > all... And just for the first layer...
>
> And do you also just see "Layer1" on your map? If so, then probably all
> your WMS layers are configured as base layers, only one of which can be
> visible at a time. The legend should show all the layers that are
> visible on the map, at least the labels with the layer names.
>
> > Is there anything else to implement ? Maybe in mapfile?
>
> I don't know much about MapServer, but I guess you have to configure
> something in your mapfile so MapServer can return a legend graphic.
> Search the MapServer documentation for GetLegendGraphic, as this is the
> request that GeoExt sends to the server to get the images.
>
> Regards,
> Andreas.
>
>
> >
> > Stella
> >
> >
> >
> > 2010/1/6 Andreas Hocevar <ahocevar at opengeo.org
> > <mailto:ahocevar at opengeo.org>>
> >
> >     On 2010-01-06 18:00, stela anders wrote:
> >     > Yeah! Thats it Andreas!
> >     >
> >     > That LegendPanel works with sublayers? I´m a little bit confused
> >     right
> >     > now!
> >
> >     The LegendPanel currently supports one image per layer. GeoServer's
> >     GetLegendGraphic e.g. returns images with symbols and text for all
> >     rules
> >     of the SLD that was used to render the layer. I think the same is
> true
> >     for MapServer, but maybe a MapServer user can give more detail about
> >     what its GetLegendGraphic returns.
> >
> >     Regards,
> >     Andreas.
> >
> >
> >     >
> >     > Thanks !
> >     >
> >     >
> >     >
> >     > 2010/1/6 Andreas Hocevar <ahocevar at opengeo.org
> >     <mailto:ahocevar at opengeo.org>
> >     > <mailto:ahocevar at opengeo.org <mailto:ahocevar at opengeo.org>>>
> >     >
> >     >     Hi,
> >     >
> >     >     make sure that your Ext JS build contains Ext.form.Label, or
> >     use a
> >     >     full
> >     >     build. The build that most of the GeoExt exmaples use
> >     >     (http://extjs.cachefly.net/builds/ext-cdn-771.js) does not
> >     contain it.
> >     >     Look e.g. at
> >     >     http://dev.geoext.org/trunk/geoext/examples/legendpanel.html,
> it
> >     >     uses a
> >     >     full build.
> >     >
> >     >     Regards,
> >     >     Andreas.
> >     >
> >     >     On 2010-01-06 16:24, stela anders wrote:
> >     >     > Thanks Andreas !!!!
> >     >     > I changed to WMS with success...
> >     >     > But now I got that error when trying to generate the legend :
> >     >     >
> >     >     > Error: Ext.form.Label is not a constructor
> >     >     > Arquivo-fonte:
> >     >     >
> >     >
> >
> http://localhost/Openlayer/Arquivos/geoextx/lib/GeoExt/widgets/LegendPanel.js
> >     >     > Linha: 293
> >     >     >
> >     >     > Am I suppossed to change anything?
> >     >     >
> >     >     > Thanks
> >     >     >
> >     >     > Stella
> >     >     >
> >     >     > 2010/1/5 Andreas Hocevar <ahocevar at opengeo.org
> >     <mailto:ahocevar at opengeo.org>
> >     >     <mailto:ahocevar at opengeo.org <mailto:ahocevar at opengeo.org>>
> >     >     > <mailto:ahocevar at opengeo.org <mailto:ahocevar at opengeo.org>
> >     <mailto:ahocevar at opengeo.org <mailto:ahocevar at opengeo.org>>>>
> >     >     >
> >     >     >     Hi,
> >     >     >
> >     >     >     On 2010-01-04 19:36, stela anders wrote:
> >     >     >     > Is it possible?
> >     >     >
> >     >     >     You have at least two choices:
> >     >     >
> >     >     >     (1) Use Layer.WMS instead of Layer.MapServer. With minor
> >     >     modifications
> >     >     >     to your mapfile, it is easy to use MapServer as WMS (see
> >     >     >     http://mapserver.org/ogc/wms_server.html). I think this
> is
> >     >     the best
> >     >     >     option, because it will build the legend automatically
> >     from
> >     >     >     GetLegendGraphic requests.
> >     >     >
> >     >     >     (2) Use a LayerStore with a legendURL field. For each
> >     layer, you
> >     >     >     have to
> >     >     >     provide a URL that points to a legend image. This
> >     option may
> >     >     only work
> >     >     >     with the current trunk version of GeoExt, not with v0.6.
> >     >     >
> >     >     >     Regards,
> >     >     >     Andreas.
> >     >     >
> >     >     >     >
> >     >     >     > I tried to create that :
> >     >     >     >   var legendPanel = new GeoExt.LegendPanel({
> >     >     >     >             title: 'Legend',
> >     >     >     >             dynamic: true
> >     >     >     >      });
> >     >     >     >
> >     >     >     > And added to Viewport, but nothing is created...
> >     >     >     >
> >     >     >     > Help me please!
> >     >     >     >
> >     >     >     >
> >     >     >     >
> >     >     >     > _______________________________________________
> >     >     >     > Users mailing list
> >     >     >     > Users at geoext.org <mailto:Users at geoext.org>
> >     <mailto:Users at geoext.org <mailto:Users at geoext.org>>
> >     >     <mailto:Users at geoext.org <mailto:Users at geoext.org>
> >     <mailto:Users at geoext.org <mailto:Users at geoext.org>>>
> >     >     >     > http://www.geoext.org/cgi-bin/mailman/listinfo/users
> >     >     >     >
> >     >     >
> >     >     >
> >     >     >     --
> >     >     >     Andreas Hocevar
> >     >     >     OpenGeo - http://opengeo.org/
> >     >     >     Expert service straight from the developers.
> >     >     >
> >     >     >     _______________________________________________
> >     >     >     Users mailing list
> >     >     >     Users at geoext.org <mailto:Users at geoext.org>
> >     <mailto:Users at geoext.org <mailto:Users at geoext.org>>
> >     >     <mailto:Users at geoext.org <mailto:Users at geoext.org>
> >     <mailto:Users at geoext.org <mailto:Users at geoext.org>>>
> >     >     >     http://www.geoext.org/cgi-bin/mailman/listinfo/users
> >     >     >
> >     >     >
> >     >     >
> >     >     > _______________________________________________
> >     >     > Users mailing list
> >     >     > Users at geoext.org <mailto:Users at geoext.org>
> >     <mailto:Users at geoext.org <mailto:Users at geoext.org>>
> >     >     > http://www.geoext.org/cgi-bin/mailman/listinfo/users
> >     >     >
> >     >
> >     >
> >     >     --
> >     >     Andreas Hocevar
> >     >     OpenGeo - http://opengeo.org/
> >     >     Expert service straight from the developers.
> >     >
> >     >
> >
> >
> >     --
> >     Andreas Hocevar
> >     OpenGeo - http://opengeo.org/
> >     Expert service straight from the developers.
> >
> >
>
>
> --
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20100107/25489c00/attachment.htm 


More information about the Users mailing list