[OpenLayers-Users] A single Editing Toolbar for multiple vector layers?

Christopher Schmidt crschmidt at metacarta.com
Thu Sep 3 15:40:21 EDT 2009


On Thu, Sep 03, 2009 at 02:26:53PM -0500, cgp wrote:
> 
> Hello, I'm fairly new to OpenLayers and would appreciate some help. 
> 
> I have a basic web application that uses the Google Maps API. Right now I'm
> just playing around with OpenLayers for training. I've looked at a lot of
> examples and I've noticed that the Editing Toolbar is always used with just
> one single vector layer. I may be missing something but I would definitely
> like the option to have just that one single editing toolbar for multiple
> different layers, like this:
> 
> ...
> var vector1 = new OpenLayers.Layer.Vector("Vector Layer 1");
> var vector2 = new OpenLayers.Layer.Vector("Vector Layer 2");
> var vector3 = new OpenLayers.Layer.Vector("Vector Layer 3");
> 
> map.addLayers([ vector1 , vector2 , vector3 ]);
> 
> map.addControl(new OpenLayers.Control.EditingToolbar([ vector1 , vector2 ,
> vector3 ])); //<----I want this
> .......
> 
> How can this be done? I've done a lot of research but I'm unable to come up
> with anything.

It's unclear to me what you want done in this case. Does drawing a feature
cause it to copy the feature to all three layers? Does the user somehow
indicate what layer they prefer? Something else?

the editingtoolbar is a very small set of code -- just a simple subclass
of the Panel class. So what you'er really talking about is the DrawFeature
control... but even with that being the case, I don't understand the exact
intention you have for having the control (or toolbar) set up on multiple
layers, so you'll need to describe your problem further.

Best Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list