[OpenLayers-Users] ModifyFeature controls on multiple layers

Andreas Hocevar ahocevar at opengeo.org
Wed Mar 27 13:32:09 PDT 2013


Hey,

what you're describing here (with the select-feature-multilayer
example) also does not work in OpenLayers 2.12. The clean way to
achieve what you want is to configure a SelectFeature control with an
array of layers. Then you register a featureselected handler for each
of these layers, and in the handler you create and activate a
ModifyFeature control with the standalone option set to true. Then you
call selectFeature on the ModifyFeature control, and editing will work
as expected. In a featureunselected handler for each layer you
deactivate and destroy the ModifyFeature control.

Andreas.

On Wed, Mar 27, 2013 at 6:23 PM, Charles Breakwell
<charles.breakwell at lmnsolutions.com> wrote:
> Hello,
>
> We recently updated from OpenLayers 2.12 to 2.13(dev version) and are
> running into a problem when using multiple modifyFeature controls.  Our
> application allows users to add layers to a map and we use modifyFeature
> controls(one per layer) to allow users to select and edit features.  This
> worked in 2.12 but now it seems like only one modify control is receiving
> any input.  With one layer the control will function as expected, but once
> more layers are added, only the modify control associated with the most
> recently added layer will function properly.  The other controls will not
> select features when the user clicks on them. However, calling the
> selectFeature method will still work.
>
> I have found that it is possible to reproduce this behavior in the
> multilayer selection example
> (http://openlayers.org/dev/examples/select-feature-multilayer.html) by using
> a web console to deactivate the select control and add a modify control to
> both vector layers.  Once the modify controls are activated you should be
> able to select features on vector layer 2 but not on vector layer 1.
>
> Any assistance would be greatly appreciated.
>
> Thank You,
> Charles Breakwell
>
> --
> Charles Breakwell
> Software Developer
> LMN Solutions
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>



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


More information about the Users mailing list