Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

GetFeature with WFS layer is not working as the click co-ordinates are returned in spherical co-ordinates.

using geoserver 2.1.3 and openlayer 2.11

layer information is in EPSG:4326 WMS works fine WFS trasaction works fine

trying to GetFeature information on click from the WFS layer as the total number of features are small and it is a custom vector layer.

control = new OpenLayers.Control.GetFeature({
    protocol: wfs_layer_protocol,
    box: false,
    hover: false,
    click: true
});

control.events.register("featureselected", this, pickNodeId);
map.addControl(control);
control.activate();

the WFS post request has the following bounds -14710846.457064 4317003.9227542-13710750.910779 6517099.4690396

share|improve this question
add comment

1 Answer 1

try this:

control = new OpenLayers.Control.GetFeature({
  protocol: OpenLayers.Protocol.WFS.fromWMSLayer(layer),
  box: true,
  hover: true,
  multipleKey: "shiftKey",
  toggleKey: "ctrlKey"
  });
control.events.register("featureselected", this, function(e) {
  var feat = e.feature;
  var res = feat.transform(map.getProjectionObject(), new OpenLayers.Projection("EPSG:4326"))
  alert(res);
  });

i hope it helps you...

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.