[OpenLayers-Dev] Newbie questions . . .

Bob Basques Bob.Basques at ci.stpaul.mn.us
Tue Jun 21 10:06:28 EDT 2011


Christopher, 

Thanks for the reply.   That's interesting that there is no way to add in a Legend (right now). 

I did mange to get something to appear (by slightly cheating), reload the link . . ..  I just added in some HTML to the Title for Line breaks, and Image SRC links.  Seemed to work pretty good.  But then I noticed that it would be nice to have the Legend graphic disappear when the layer was toggled off.  I keep making work for myself. I have no idea what this approach might break along the way.  I could expand on this and try to build in a dynamic Legend item I suppose,  but it doesn't seem like the right approach to take.  I not much at Javascript either.  More of an "example tweeker" as far as Javascript goes. 

I'm doing something really quick and dirty right now.  But I suspect that I may be doing more of these in the future. 

bobb 



>>> <christopher.schmidt at nokia.com> wrote:



On Jun 17, 2011, at 5:45 PM, ext Bob Basques wrote:

> All,
>
> Playing around with my first (official) Openlayers Viewer.  http://pwultra5.ci.stpaul.mn.us/ol/ol.03.html
>
> A couple of questions:
>
> 1.)  How do I add in a Legend Graphic for each layer to the LayerSwitcher from a MapServer CGI call?
> For example, here is the call to a legend for the Street centerlines: http://gis.ci.stpaul.mn.us/datasets/SHP/METC/TLG/CENTERLINES_TLG/tlg_googlish1_public.map?mapext=524489.6712328767%20136826.90753424657%20618818.3287671233%20172992.09246575343&mapsize=1072%20411&mode=legend
> I did find some examples for WMS, but they didn't seem to be what I was looking for.

You'll probably need to write your own LayerSwitcher. We don't have any supported way
of doing this that I'm aware of; there are a few hacks out there that people have
done, but I don't think we've integrated them into the LayerSwitcher in trunk.

> 2.)  How do I set the Layer Switcher to be activated (displayed) by default (vs closed on startup)?

http://dev.openlayers.org/docs/files/OpenLayers/Control/LayerSwitcher-js.html#OpenLayers.Control.LayerSwitcher.maximizeControl

> bobb
> _______________________________________________
> Dev mailing list
> Dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20110621/1fffabf7/attachment.html


More information about the Dev mailing list