[OpenLayers-Users] GetFeatureInfo and overlays
James McManus
jmpmcmanus at yahoo.com
Sun Jun 8 19:04:40 EDT 2008
Eric,
Thanks!
Eric Lemoine wrote:
> Hi James
>
> On Fri, Jun 6, 2008 at 6:27 PM, James McManus <jmpmcmanus at yahoo.com> wrote:
>
>> Is there a standard way to enable GetFeatureInfo to only query from the
>> current overlay being displayed? QUERY_LAYERS enables you to query more
>> than one layer, but if FEATURE_COUNT is set to 1 then the info from the
>> last layer on the list is displayed. You can set FEATURE_COUNT to a
>> higher number, but I do not want to do that. Is there a standard way of
>> linking LayerSwitcher with GetFeatureInfo?
>>
>
> You can have your "click on map" handler get the list of visible
> overlays and use that list in the GetFeatureInfo request, with
> something like the following:
>
> var QUERY_LAYERS=[];
> for (var i = 0; i < map.layers.length; i++) {
> var layer = map.layers[i];
> if (!layer.isBaseLayer && layer.getVisibility()) {
> QUERY_LAYERS.push(layer.name);
> }
> }
>
> Would that work for you?
>
> Cheers,
> --
> Eric
>
>
More information about the Users
mailing list