After some experimenting I'm convinced the GetFeature control is definitely the 
best choice for the (our) job. Thanks for all the suggestions, they have put us 
definitely on the right track!

Now I just have 1 small question left. The layers the GetFeature control must 
query can be different with each and every request (because of zoom level & 
user can select/unselect layers as well), so I had to define my own protocol. 
What I have implemented really works great, but I was wondering if this is 
really how you are supposed to use the OpenLayers API. Would be great to get 
some feedback about my custom control.

var control = new OpenLayers.Control.GetFeature({
        click : true,
        clickTolerance : 10,
        protocol : new OpenLayers.Protocol.HTTP({
                format : new OpenLayers.Format.GeoJSON(),
                url : URL,
                read : function(options) {
                        options = options || {};
                        options.callback = function(result) {
                                if (result.success()) {
                                        // process features
                                }
                                // reset the cursor
                                
OpenLayers.Element.removeClass(this.map.viewPortDiv, "olCursorWait");
                        };
                        options.params = 
OpenLayers.Util.applyDefaults(options.params, {
                                layers : getDataLayerNames(),
                                request : "GetFeature"
                        });
                        OpenLayers.Protocol.HTTP.prototype.read.apply(this, 
arguments);
                }
        })
})

Kind regards,
Roel

________________________________________
Van: openlayers-users-boun...@lists.osgeo.org 
[openlayers-users-boun...@lists.osgeo.org] namens Phil Scadden 
[p.scad...@gns.cri.nz]
Verzonden: zondag 18 januari 2015 21:11
Aan: openlayers-users@lists.osgeo.org
Onderwerp: Re: [OpenLayers-Users] Alternatives to get rid of WFS layers

 >Currently I use a GetFeature control with a custom defined protocol to
execute the WFS request and process the results. Is this the best
 >control for this scenario? Or would a SelectFeature control (or
another one) be more suitable for this job?

My code for doing this is quite old and definitely work in the "if ain't
broke, dont fix it" mode. I use a custom wfs protocol tied to
"featureadded" of a point Drawfeature control. I think at the time, it
was a way to give more control over the radius of selection. Since I
used near identifical code for "select by polygon" (use a polygon
handler instead of point handler in the draw control) it may simply have
been economy of effort. I have only used selectFeature control with
vector layers (kml) but I struggle to remember the decision-making
process around that.

Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.

_______________________________________________
Users mailing list
us...@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users
[Congres publieke ruimte]<http://www.congrespubliekeruimte.be>
________________________________

Volg Aquafin op Facebook<https://www.facebook.com/AquafinNV> | 
Twitter<https://twitter.com/aquafinnv> | 
YouTube<http://www.youtube.com/channel/UCk_4P5BJ-MtEEDCkCsR_KqQ?feature=mhee> | 
LinkedIN<http://www.linkedin.com/company/aquafin/products>

Disclaimer: zie www.aquafin.be<http://www.aquafin.be>   P Denk aan het milieu. 
Druk deze mail niet onnodig af.
_______________________________________________
Users mailing list
us...@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to