GetFeature with WFS layer is not working as the click coordinates are returned in spherical coordinates.

Using GeoServer 2.1.3 and OpenLayers 2.11

Layer information is in EPSG:4326, WMS works fine, WFS transaction 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);

The WFS post request has the following bounds:

<gml:lowerCorner>-14710846.457064 4317003.9227542</gml:lowerCorner> 
<gml:upperCorner>-13710750.910779 6517099.4690396</gml:upperCorner>  

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"))

i hope it helps you...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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