[OpenLayers-Users] Newbie questions

Joe public joepub1962 at gmail.com
Sun Feb 28 12:51:35 EST 2010


Pablo:
Thanks for the help!!
I have a good idea as to how the popup works and that the feature info got
the
layers that active and so far I have not found a way to display only the
info for the topmost layer
I'll keep digging...

In the meantime... I have another question.....

When I click anywhere outside of the map I get a empty popup box/cloud
I add the following if statement but still get the empty popup...

getfeatureinfo: function(event) {
if (event.text.indexOf() == -1)


Any suggestions as to how to prevent the pop in places that there should not
be any

Thanks

       map.addLayers([pwms,rwms,iwms]);

        info = new OpenLayers.Control.WMSGetFeatureInfo({
            url: 'http://tobagoborn.com:8080/geoserver/wms',
            title: 'Identify features by clicking',
            queryVisible: true,
            eventListeners: {
                getfeatureinfo: function(event) {
if (event.text.indexOf() == -1)    <-- ADDED THIS IF STATMENT
  {
                    map.addPopup(new OpenLayers.Popup.FramedCloud(
                        "chicken",
                        map.getLonLatFromPixel(event.xy),
                        null,
                        event.text,
                        null,
                        true
                    ));
}
                }
            }
        });
        map.addControl(info);
        info.activate();




On Fri, Feb 26, 2010 at 5:09 PM, Joe public <joepub1962 at gmail.com> wrote:

> Pablo:
> Before I got you reply which I'll try,,, I found and tried the following:
>
> QUERY_LAYERS: map.layers[2].params.LAYERS,
>
> But it didn't have the effect I wanted.....
>
> What I really want is the pop up to show ONLY data for the active layer....
> Right now it is show data for the active layer plus the layer(s) underneath
> Is this possible?
>
>
>
> On Fri, Feb 26, 2010 at 10:20 AM, pablo lopez <plablo09 at gmail.com> wrote:
>
>>
>>
>> Hi Joe, I think something like this shoul do it:
>>
>>        info = new OpenLayers.Control.
>> WMSGetFeatureInfo({
>>            url: 'http://tobagoborn.com:8080/geoserver/wms',
>>            title: 'Identify features by clicking',
>>            layers: [layer1, layer2,...],  <---Here you provide an array of
>> layer objects. These are the layers you are querying
>>            eventListeners: {
>>                getfeatureinfo: function(event) {
>>                    map.addPopup(new OpenLayers.Popup.FramedCloud(
>>                        "chicken",
>>                        map.getLonLatFromPixel(event.xy),
>>                        null,
>>                        event.text,
>>                        null,
>>                        true
>>                    ));
>>                }
>>            }
>>        });
>>        map.addControl(info);
>>        info.activate();
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100228/ebf292a0/attachment.html


More information about the Users mailing list