3

I am developing GIS Portal using OpenLayers, I use WFS GetFeature to retrieve some data like bellow:

var layer = map.getLayersByName("pf_trecho_at");
var polygonLayer = new OpenLayers.Layer.Vector("Polygon Layer");
var protocol = new OpenLayers.Protocol.WFS.fromWMSLayer(layer[0], {
                    url: "/geoserver/wfs",
                    featurePrefix: 'light',
                    readFormat: new OpenLayers.Format.GeoJSON(),
                    outputFormat: "JSON",
                    extractAttributes: true
                });
control = new OpenLayers.Control.GetFeature({                   
            protocol: protocol,
            box: true,
            hover: true,
            multipleKey: "shiftKey",
            toggleKey: "ctrlKey"
        });

control.events.register("featureselected", this, function(e) {                  
            polygonLayer.addFeatures([e.feature]);

            this.displayPopup(e, 'pf_trecho_at');
        });
        control.events.register("featureunselected", this, function(e) {
            polygonLayer.removeFeatures([e.feature]);
        });

map.addLayer(polygonLayer);
map.addControl(control);
control.activate();

My doubt is, the selection control draw a rectangle to select the features, is it possible to draw a circle to select then?

1 Answer 1

3

The link below contains an example using an OpenLayers2 DrawFeature control that allows to select features via a circle. It can help using WFS GetFeature to retrieve some datas using polygon or linestring drawing tools ows.js : Ease OGC Web Services (OWS) calls with javascript.

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.