[OpenLayers-Dev] GetFeature control question

Eric Lemoine eric.lemoine at camptocamp.com
Tue Feb 9 01:47:34 EST 2010


On Saturday, February 6, 2010, Andreas Hocevar <ahocevar at opengeo.org> wrote:
> Eric Lemoine wrote:
>
> On Mon, Jan 11, 2010 at 3:22 PM, Bart van den Eijnden <bartvde at osgis.nl> wrote:
>
>
> Hi list,
>
> I am failing to understand the following line in OpenLayers.Control.GetFeature:
>
> maxFeatures: options.single == true ? this.maxFeatures : undefined,
>
> I would expect it to be:
>
> maxFeatures: options.single == true ? 1: this.maxFeatures,
>
> so if we only want a single feature, have it set to 1, otherwise use the maxFeatures given by the application designer.
>
>
>
> I'd make more sense to me too.
>
>
>
> You are looking at this line without the context. There is also:
>
> if(options.single == true) {
>    this.selectBestFeature(result.features,
>    bounds.getCenterLonLat(), options);
> } else {
>    this.select(result.features);
> }
>
> One of the key advantages of the GetFeature control over WMSGetFeature is that it will *always* just return *one single feature* on a click, and this feature will be the *best matching one*. The maxFeatures config option is just about how many features to use to determine the best matching one. Maybe this should be documented better.

Thanks for the explanation Andreas. I also didn't understand that part
of the code. Clear now.



-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com



More information about the Dev mailing list