Skip to main content
moved code from comments to question. retag
Source Link

I am projecting a WMS layer on a map using OpenLayers and Geoserver. The next thing I want to do is to display info on any given feature in my WMS-layer in a pop up whenever a user clicks it.

This is all working fine, but my problem is that whenever I click outside the WMS layer, I get an empty pop up. However, I only want a pop up to appear when a user clicks an actual feature.

Does anyone know how to fix this?

Code:

info = new OpenLayers.Control.WMSGetFeatureInfo({
    url: 'http://../geoserver/cite/wms', title: 'Vraag informatie op over een melding door erop te klikken',
    queryVisible: true,
    eventListeners: {
    getfeatureinfo: function(event) {
        deletePopup();
        popup = new OpenLayers.Popup.FramedCloud( "chicken", map.getLonLatFromPixel(event.xy), null, event.text, null, true );
        map.addPopup(popup); } } });
map.addControl(info); info.activate();

I am projecting a WMS layer on a map using OpenLayers and Geoserver. The next thing I want to do is to display info on any given feature in my WMS-layer in a pop up whenever a user clicks it.

This is all working fine, but my problem is that whenever I click outside the WMS layer, I get an empty pop up. However, I only want a pop up to appear when a user clicks an actual feature.

Does anyone know how to fix this?

I am projecting a WMS layer on a map using OpenLayers and Geoserver. The next thing I want to do is to display info on any given feature in my WMS-layer in a pop up whenever a user clicks it.

This is all working fine, but my problem is that whenever I click outside the WMS layer, I get an empty pop up. However, I only want a pop up to appear when a user clicks an actual feature.

Does anyone know how to fix this?

Code:

info = new OpenLayers.Control.WMSGetFeatureInfo({
    url: 'http://../geoserver/cite/wms', title: 'Vraag informatie op over een melding door erop te klikken',
    queryVisible: true,
    eventListeners: {
    getfeatureinfo: function(event) {
        deletePopup();
        popup = new OpenLayers.Popup.FramedCloud( "chicken", map.getLonLatFromPixel(event.xy), null, event.text, null, true );
        map.addPopup(popup); } } });
map.addControl(info); info.activate();
corrected spelling, fixed grammar, improved formatting.
Source Link
Fezter
  • 22k
  • 11
  • 71
  • 126

I am projecting a WMS layer on a map using OpenLayers and Geoserver. The next thing I want to do is to display info on any given feature in my WMS-layer in a pop up whenever a user clicks it.

This is all working fine, but my problem is that whenever I click outside the WMS layer, I get an empty pop up. However, I only want a pop up to appear when a user clicks an actual feature.

Does anyone know how to fix this? Thanks in advance!

I am projecting a WMS layer on a map using OpenLayers and Geoserver. The next thing I want to do is to display info on any given feature in my WMS-layer in a pop up whenever a user clicks it.

This is all working fine, but my problem is that whenever I click outside the WMS layer, I get an empty pop up. However, I only want a pop up to appear when a user clicks an actual feature.

Does anyone know how to fix this? Thanks in advance!

I am projecting a WMS layer on a map using OpenLayers and Geoserver. The next thing I want to do is to display info on any given feature in my WMS-layer in a pop up whenever a user clicks it.

This is all working fine, but my problem is that whenever I click outside the WMS layer, I get an empty pop up. However, I only want a pop up to appear when a user clicks an actual feature.

Does anyone know how to fix this?

corrected spelling, fixed grammar, improved formatting.
Source Link

prevent Prevent popup from appearing when clicking outside wmsWMS layer

Any help with this would be appreciated. I am projecting a WMS-layer layer on a map using OpenLayers and Geoserver. The next thing I want to do is to display info on any given feature in my WMS-layer in a popuppop up whenever a user clicks it.

This is all working fine, but my problem is that whenever I click outside the WMS-layer layer, I get an empty popuppop up. However, I only want a popuppop up to appear when a user clicks an actual feature.

Does anyone know how to fix this? ThnxThanks in advance!

prevent popup from appearing when clicking outside wms layer

Any help with this would be appreciated. I am projecting a WMS-layer on a map using OpenLayers and Geoserver. The next thing I want to do is to display info on any given feature in my WMS-layer in a popup whenever a user clicks it.

This is all working fine, but my problem is that whenever I click outside the WMS-layer, I get an empty popup. However, I only want a popup to appear when a user clicks an actual feature.

Does anyone know how to fix this? Thnx in advance!

Prevent popup from appearing when clicking outside WMS layer

I am projecting a WMS layer on a map using OpenLayers and Geoserver. The next thing I want to do is to display info on any given feature in my WMS-layer in a pop up whenever a user clicks it.

This is all working fine, but my problem is that whenever I click outside the WMS layer, I get an empty pop up. However, I only want a pop up to appear when a user clicks an actual feature.

Does anyone know how to fix this? Thanks in advance!

Source Link
Michiel
  • 75
  • 1
  • 5
Loading