0

I have added the WMS line feature in vector layer. But I am facing some display problem in it as shown below screenshot.Is there anyother way to do this?

enter image description here

But there is no issue in point features.

enter image description here

Here is my code:

 selectionLayer = new OpenLayers.Layer.Vector("Selection", { styleMap:
            new OpenLayers.Style(OpenLayers.Feature.Vector.style["select"]),
    displayInLayerSwitcher: false,
    isBaseLayer: false
});

osMap.addLayers([selectionLayer]);

var wmsFeatInfo = new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://xxx.xxx.x.xx:8080/geoserver/cite/wms',
    title: 'identify features on click',        
    queryVisible: true
});
wmsFeatInfo.infoFormat = 'application/vnd.ogc.gml';
wmsFeatInfo.events.register("getfeatureinfo", this, getWmsFeatAttributes);
osMap.addControl(wmsFeatInfo);
wmsFeatInfo.activate();

function getWmsFeatAttributes(e) {
    selectFeatLst = {};
    if (e.features.length > 0) {       
        for (var ii = 0; ii < e.features.length; ii++) {            
           var layer_ID = e.features[ii].fid.split('.');            
           var featId = layer_ID[1];            
           selectFeatLst[featId] = e.features[ii];
        }        
    }
 }

 function test(key){ 
    selectionLayer.addFeatures([selectFeatLst[key]]); //Here line feature is adding 
 }

Please suggest me to fix this issue.

  • What is the problem? What do you expect it to do? – til_b Oct 18 '13 at 11:27
  • Please see the first screenshot. Its highlighting somewhere instead of that line – venkat Oct 21 '13 at 8:54
  • @venkat: It is not clear what you are trying to show, by using the Image. – Devdatta Tengshe Oct 21 '13 at 9:18
  • Blue color is the selection color. It should select the line from 'start' to 'end'. But the selection appear somewhere else – venkat Oct 21 '13 at 9:47
  • Can you please show the code or values ect where you add the feature to the selectionLayer OpenLayers.Layer.Vector layer. The way you have the code setup here seems to indicate that everything in that layer would display as though selected. In the top picture the lines that appear to have been added(and aren't in the bottom picture) appear to be highlighted as though they are selected. The line that you indicate in the top picture that you want highlighted appears in the bottom picture as well. – Darkcylde Oct 22 '13 at 0:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.