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

Christopher Schmidt crschmidt at metacarta.com
Thu Sep 3 16:34:03 EDT 2009


On Thu, Sep 03, 2009 at 03:23:44PM -0500, cgp wrote:
> 
> Sorry, I didn't explain my problem well. In the application, the user would
> have the option to create/edit vector layers on top of Google maps base
> layers. I created a custom toolbar panel that has a drawFeaturePoint,
> drawFeaturePath, drawFeaturePolygon etc. The user can specify what layer to
> edit by clicking on an 'edit' button that I created. 
> 
> My question is, how do I specify to the drawFeature controls what layer it
> should draw on?

The DrawFeature controls take the Layer to draw on as the first parameter
when they are created.

-- Chris

> 
> 
> Christopher Schmidt-2 wrote:
> > 
> > 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
> > _______________________________________________
> > Users mailing list
> > Users at openlayers.org
> > http://openlayers.org/mailman/listinfo/users
> > 
> > 
> 
> -- 
> View this message in context: http://n2.nabble.com/A-single-Editing-Toolbar-for-multiple-vector-layers-tp3575527p3575839.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users

-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list