[Geoserver-users] Selecting multiline feature with a BBox(dragbox)

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.

Regards,
Manish Barapatre

Office: 01473 650516

Hi Marish,
This may be better suited to the OpenLayers list. From what I’m reading it looks like the issue isn’t GeoServer but OL.
http://trac.osgeo.org/openlayers/wiki/MailingLists
Jonathan

On 24 January 2013 16:36, <manish.barapatre@anonymised.com> wrote:

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.

Regards,
Manish Barapatre

Office: 01473 650516


Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only – learn more at:
http://p.sf.net/sfu/learnnow-d2d


Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

This transmission is intended for the named addressee(s) only and may contain sensitive or protectively marked material up to RESTRICTED and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All email traffic sent to or from us, including without limitation all GCSX traffic, may be subject to recording and/or monitoring in accordance with relevant legislation.