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

stela anders stelaanders at gmail.com
Fri Jan 8 19:00:33 CET 2010


Thanks Andreas... ;)
displayInLayerSwitcher did the trick !!!

I have some point layer with image symbol (.gif - 16x15) ... The legend icon
in that case stay ugly (only part of image appears)...
Any idea why that? Or maybe is a restriction?

Thanks so much! U r saving my week ;)

Stella

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

> 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...)
>>
>
> The LegendPanel does exactly that. It requests one image per sublayer (now
> that you provided a code snippet and I finally know what you meant by
> "sublayer"). 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20100108/27fe52ea/attachment.htm 


More information about the Users mailing list