[OpenLayers-Dev] Selecting multiline feature with a BBox(dragbox)

manish.barapatre at bt.com manish.barapatre at bt.com
Mon Jan 28 07:22:59 PST 2013

need technical help/ guidance on OpenLayers. We're stuck with following technical issue and seeking technical help/ advice for resolving the same.

*         We are using Wms services (layers published via Geoserver), to display point, line and polygon features onto the map.
We are using the OpenLayers property "new OpenLayers.Layer.WMS()", for displaying the layers.

*         However, the problem that we are facing is in using OpenLayers.Control.GetFeature control. We have to perform a selection using BBox(drag box) and have used

the following code:

                control_select = new OpenLayers.Control.GetFeature({
        protocol: OpenLayers.Protocol.WFS.fromWMSLayer(layerName),
        box: true,
        hover: true,
        multipleKey: "shiftKey",
        toggleKey: "ctrlKey"
This control is then added to the map.

*         The point feature selection works perfectly but when we select just one line feature, it happens to select many line features (sometimes more than 30 line features!).

Most of the lines are not even close or connected to the selected line feature!

We are using the "featureselected" event to capture the selection made by the drag box.

Syntax:- "control_select.events.register("featureselected", this, function(e) {}"

*         We tried to debug OpenLayers.js. It has a predefined set of Geometry types:

var order=["MultiPolygon","Polygon","MultiLineString","LineString","MultiPoint","Point","Envelope"]

We have a table (for the line feature), that has a shape field as Multiline, which is then converted to Oracle Spatial format and then web services are created.

After the drag box is created, Openlayers identifies the selected feature as "MultiLineString" and somehow relates many other line features to create a tree structure.

It forms one parent node and this node has a nextSibling, which is another line feature. In this way, it creates a hierarchy of "nextSibling" for every previous Sibling, thus

selecting a huge range of line features!

*         There is an array called "features" created by OpenLayers, where it pushes all the obtained features from the node:- "obj.features.push(feature);"
Depending on the length of the array, "featureselected" event is fired that many times thus returning all the features instead of only the selected ones.

Manish Barapatre
Office: 01473 650516

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20130128/2c6c0f23/attachment.html>

More information about the Dev mailing list