[OpenLayers-Users] Customising Toolbar

Christopher Schmidt crschmidt at metacarta.com
Wed Apr 25 12:58:14 EDT 2007


On Wed, Apr 25, 2007 at 04:53:38PM +0000, Benoit PESTY wrote:
> My problem is that the OpenLayers.Control.SelectFeature is meant to be used 
> with a vector layer.
> 
> I want to be able to click anywhere on the map and to launch a WFS request 
> directly.
> 
> The onSelect and onUnselect callbacks are not launched if my cursor is not 
> on a feature.
> I'd like to call my function on a onClick event and to be able to toggle 
> on/off this kind of event with the toolbar.

Yes, you'll need to make your own control. I've done something similar
to this on http://labs.metacarta.com/osm/ : you click on the 'osm' tool,
and then you can click to see a list of features near your click. The
pieces are all in:

  http://labs.metacarta.com/osm/osmutils.js

You can see the Handler, Control, and Toolbar code there.  

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list