[OpenLayers-Dev] GetFeature control question

Andreas Hocevar ahocevar at opengeo.org
Sat Feb 6 13:21:45 EST 2010


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.

Regards,
Andreas.

-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.




More information about the Dev mailing list