[Geomoose-users] Mouseover map area to show pop up or link

Len Kne lkne at houstoneng.com
Thu Jun 3 10:06:11 EDT 2010


One way would be to use OL Hover handler - see http://openlayers.org/dev/examples/hover-handler.html.  Basically it is going to make an ajax call to the identify service when the cursor hovers over a spot for a set time.  The script below works in my testing environment... it could be enabled as a tool or in onLoadedMapbook().

Len

// Hover support on WMS and MapServr layers
                var popup;
                OpenLayers.Control.Hover = OpenLayers.Class(OpenLayers.Control, {
                defaultHandlerOptions: {
                    'delay': 500,
                    'pixelTolerance': 20,
                    'stopMove': false
                },

                initialize: function(options) {
                    this.handlerOptions = OpenLayers.Util.extend(
                        {}, this.defaultHandlerOptions
                    );
                    OpenLayers.Control.prototype.initialize.apply(
                        this, arguments
                    );
                    this.handler = new OpenLayers.Handler.Hover(
                        this,
                        {'pause': this.onPause, 'move': this.onMove},
                        this.handlerOptions
                    );
                },

                onPause: function(evt) {
                                                var feature = Map.getLonLatFromPixel(evt.xy);
                                                var url = '/php/identify.php?';
                                                var layersArray = GeoMOOSE.getVisibleLayers();
                                                layers = layersArray.join(':');
                                                var requestOptions = OpenLayers.Request.GET({
                                                                url: url,
                                                                params: {'shape': 'POINT(' + feature.lon + ' ' + feature.lat + ')',
                                                                                'layers': layers,
                                                                                '_moosetime': (new Date()).getTime() },
                                                                async: false
                                                });

                                                if(requestOptions.responseText) {
                                                                popup = new OpenLayers.Popup.FramedCloud("wms",
                                                                                Map.getLonLatFromPixel(evt.xy),
                                                                                null,
                                                                                requestOptions.responseText,
                                                                                null, false);
                                                                Map.addPopup(popup);
                                                }
                },

                onMove: function(evt) {
                                                if (popup != null) {
                                                popup.destroy();
                                                popup = null;
                                                }

                    // if this control sent an Ajax request (e.g. GetFeatureInfo) when
                    // the mouse pauses the onMove callback could be used to abort that
                    // request.
                }
            });

                hover = new OpenLayers.Control.Hover();
                Map.addControl(hover);
                hover.activate();



From: FRANZ OKYERE [mailto:franzzoa at hotmail.com]
Sent: Wednesday, June 02, 2010 4:28 PM
To: Geomooselist
Subject: Re: [Geomoose-users] Mouseover map area to show pop up or link

Thanks,

But is geomoose not based on open layers? If it is then what we can do in open layers should be possible in geomoose, right? I really need to do this so if you can point me in the right direction and show me which of the javascript files I should be editing that would be nice.

Franz
________________________________
Date: Wed, 2 Jun 2010 14:29:24 -0500
From: Bob.Basques at ci.stpaul.mn.us<mailto:Bob.Basques at ci.stpaul.mn.us>
To: bfraser at geoanalytic.com<mailto:bfraser at geoanalytic.com>; franzzoa at hotmail.com<mailto:franzzoa at hotmail.com>
CC: geomoose-users at lists.sourceforge.net<mailto:geomoose-users at lists.sourceforge.net>
Subject: Re: [Geomoose-users] Mouseover map area to show pop up or link
All,

Not on the feature(s), but the layer name/metadata icon in the side menu.

bobb




>>> Brent Fraser <bfraser at geoanalytic.com<mailto:bfraser at geoanalytic.com>> wrote:
You mean by simply moving the cursor over the feature but not clicking it?
Geomoose no (as far as I know). OpenLayers has a hover handler so we might be
able to use that...

Brent Fraser

FRANZ OKYERE wrote:
> Hello all,
>
> I am using geomoose 2.2 and wish to do what google maps or bing maps are
> able to do- i.e. mouseover a location on the map and then get the popup
> showing up. Any ideas? Is such a thing possible at all in geomoose?
>
> Cheers.
>
> Franz
>
> GIS Specialist, Ghana.
>
> ------------------------------------------------------------------------
> Get a free e-mail account with Hotmail. Sign-up now.
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Geomoose-users mailing list
> Geomoose-users at lists.sourceforge.net<mailto:Geomoose-users at lists.sourceforge.net>
> https://lists.sourceforge.net/lists/listinfo/geomoose-users


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Geomoose-users mailing list
Geomoose-users at lists.sourceforge.net<mailto:Geomoose-users at lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/geomoose-users

________________________________
Get a new e-mail account with Hotmail - Free. Sign-up now.<http://clk.atdmt.com/UKM/go/197222280/direct/01/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geomoose-users/attachments/20100603/279ecc47/attachment.html


More information about the Geomoose-users mailing list