Tell me more ×
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

2 Answers

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

The openlayers Control.GetFeature() sending spherical bbox co-ordinates means,

  • no features are retrieved from the geoserver as the co-ordinates don't match ( layer in 4326 request sent in 900913).

Looking for a way to force openlayers Control.GetFeature() to send requests in native layer co-ordinates. (in this case EPSG 4326 and not 900913)

share|improve this answer

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.