[Users] How to create legend panel using OpenLayers.Layer.MapServer layer...
Andreas Hocevar
ahocevar at opengeo.org
Fri Jan 8 16:54:25 CET 2010
stela anders wrote:
> 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
> }),
The above should cause three GetFeatureInfo requests to be issued: one
for each of your sublayers. If you just see the label, then MapServer
does not send you an image on the GetFeatureInfo request. Here is what
you can try: enable the Net panel on firebug and look at the
GetFeatureInfo request that the browser issues. Copy them, open them in
a browser window/tab, and fix your mapfile until they work (more help
available in mapserver docs/lists).
>
> OpenLayers.Layer.WMS("Layer2",
> mycgi, {
> map: mymapfile,
> layers: ['Sublayer21','Sublayer22', 'Sublayer23'],
> format: "image/png",
> transparent: "true"
> }, {
> isBaseLayer: false,
> displayInLayerSwitcher: false,
> visibility: true
> }),
This won't display anything, because you have set
"displayInLayerSwitcher" to false.
> 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...)
My suggestion is: fix your mapfile so Mapserver can answer
GetFeatureInfo requests correctly.
Regards,
Andreas.
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Users
mailing list