When i open some page, i want to show only WMS layers. When clicking on some parcel, as response, it should call WFS, and show information of that parcel, and only that one. How can i manage that with Openlayers 2.13?

  • You may also do that with WMS and GetFeatureInfo. Check if server supports GML or GeoJSON as INFO_FORMAT. GeoServers by default do. – user30184 Apr 6 '15 at 19:42

You need to write a custom control that does that thing. Ive written a tutorial on the topic, so check it out :) http://codentonic.net/2015/04/02/custom-openlayer-control/ if you have any questions feel free to ask me

  • Wow, you really did a nice work. I'll try simpler solution, and if it doesn't work, i'll call for your help :) – Stefan Mihajlovic Apr 8 '15 at 9:04

Just use the OpenLayers.Control.GetFeature:

var your_control = new OpenLayers.Control.GetFeature({
            protocol: OpenLayers.Protocol.WFS.fromWMSLayer(your_wms_layer),
            box: true,
            hover: true,
            multipleKey: "shiftKey",
            toggleKey: "ctrlKey"


Your Answer

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

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