[OpenLayers-Dev] Hover over point - Display name

Alexandre Dube adube at mapgears.com
Tue Aug 10 08:42:34 EDT 2010


Hi,

Maybe you could do (untested) :


var featureInfo = new OpenLayers.Control.WMSGetFeatureInfo({
             url: 'http://spatialserver.net:8080/geoserver-nijel/wms',
	    queryVisible: true,
	    //hover: true,
	    layers: [mix_market_grossloan, mdgwatsanpipe_dwtpipe,
mdgwatsanpipe_dwtwoac, mdgwatsanpipe_sntwoac, hunger_uw, poverty_last,
countries, wo_fis, wo_partnerorgs, wo_programs_inactive, wo_programs_active,
wo_programs_featured],
             eventListeners: {
                 getfeatureinfo: function(event) {
                     // remove any popups before adding new ones
                     for (var i=0, len=map.popups.length; i<len; i++) {
                         map.removePopup(map.popups[i]);
                     }
                     map.addPopup(new OpenLayers.Popup.FramedCloud(
                         null,
                         map.getLonLatFromPixel(event.xy),
                         null,
                         event.text,
                         null,
                         true
                     ));
                 }
            }
         });


Regards,

Alexandre


On 10-08-09 06:34 PM, lcp-2 wrote:
> I am also trying to get hover to work for WMSGetFeatureInfo.
>
> I have hover working but popups do not disappear as new ones are created and
> empty popups appear where there are no features.
>
> How do I get popups to appear one at a time and only ver features with
> hover? Below is the code I am using for GetFeatureInfo:
>
>    //Click on visible features for popup info
> var featureInfo = new OpenLayers.Control.WMSGetFeatureInfo({
>              url: 'http://spatialserver.net:8080/geoserver-nijel/wms',
> 	    queryVisible: true,
> 	    //hover: true,
> 	    layers: [mix_market_grossloan, mdgwatsanpipe_dwtpipe,
> mdgwatsanpipe_dwtwoac, mdgwatsanpipe_sntwoac, hunger_uw, poverty_last,
> countries, wo_fis, wo_partnerorgs, wo_programs_inactive, wo_programs_active,
> wo_programs_featured],
>              eventListeners: {
>                  getfeatureinfo: function(event) {
>                      map.addPopup(new OpenLayers.Popup.FramedCloud(
>                          null,
>                          map.getLonLatFromPixel(event.xy),
>                          null,
>                          event.text,
>                          null,
>                          true
>                      ));
>                  }
>             }
>          });
>
>    


-- 
Alexandre Dubé
Mapgears
www.mapgears.com




More information about the Dev mailing list