[OpenLayers-Dev] GetFeature control question

Andreas Hocevar ahocevar at opengeo.org
Sat Feb 6 14:55:52 EST 2010


bartvde at osgis.nl wrote:
> Andreas,
>
> but why do you not leave the best match up to the WFS by specifying
> maxFeatures 1? What is the purpose/advantage of doing this client-side?
>   

Where does the WFS spec say that setting maxFeatures to 1 will return 
the best matching feature? Usually that returns the first one matching 
the filter condition.

Regards,
Andreas.

> Best regards,
> Bart
>
>   
>> 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.
>>
>>
>>     
>
>
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
>   


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




More information about the Dev mailing list