[OpenLayers-Users] Custom toolbars outside the map

Andreas Hocevar ahocevar at opengeo.org
Thu Feb 25 08:44:54 EST 2010


Frost89 wrote:
> Hi all
> 
> I'm trying to add a custom toolbar to my map webapp. I was trying to use
> Control.Panel, but besides the standard controls in OpenLayers I also need
> to add some custom function such as print/user management and some others.
> 
> So I was thinking if I would be able to make my own toolbar (I'm using a
> standard HTML <ul>) and then add a onClick handler, which could set the
> active tool to eg. being zoom in.
> 
> Or are there any other alternatives?

There are many ways to do it for sure. But the OpenLayers way would be 
to use Control.Panel, configure it with the div that you want it to be 
rendered in (i.e. some container outside the map), and use 
OpenLayers.Control.Button for your custom controls.

Look at the [1] example to see which css classes you need to give your 
custom controls the icons you want, and [2] to see how to place it 
outside the map.

Regards,
Andreas.

[1] http://openlayers.org/dev/examples/panel.html
[2] http://openlayers.org/dev/examples/editingtoolbar-outside.html

> 
> / Kristian


-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.



More information about the Users mailing list