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

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


Hi Franz

The code I posted still needs some work to be integrated with GM, specifically it bypasses calling the service processing portion of GM.  So when using the Identify service (or any other service) in GM, GM is expecting the results to come back as XML.  The hover script is not expecting XML, just plain text or HTML.  As the hover script is, you will need to have a custom identify.php to send the results back.  Near the end of identify.php, modify the following lines:


header('Content-type: application/text');
//print "<results>";
//print "<script/>";
//print "<html><![CDATA[";
print processTemplate($contents, $substArray);
//print "]]></html>";
//print "</results>";

Len

From: FRANZ OKYERE [mailto:franzzoa at hotmail.com]
Sent: Thursday, June 10, 2010 3:03 AM
To: Geomooselist
Subject: Re: [Geomoose-users] Mouseover map area to show pop up or link

Hi Len,
I stuck your code the following function definition but even thought the  popup shows up it does not contain any information.

this.onLoadedMapbook = function(mapbookXML) {
#your hover code

}

 I changed the line setting the url to the identify.php like this to suite my local settings.

var url = 'http://localhost/moosecache2/php/identify.php?';

I am not sure if there is something else I need to do to. I have seen it work on your site so it should work on my I suppose.

Franz


> From: lkne at houstoneng.com
> To: bfraser at geoanalytic.com
> Date: Thu, 3 Jun 2010 15:40:50 +0000
> CC: geomoose-users at lists.sourceforge.net
> Subject: Re: [Geomoose-users] Mouseover map area to show pop up or link
>
> Performance seems ok, you can try it at http://dev.houstoneng.net/geomoose.html. Hover over a parcel for 1 second and you should get a popup. It's different than passing over a marker in OL because the handler is triggered after a pause in mouse movement vs. going over the marker. The downside is there will be a lot of calls back to the server (could be an issue on a high use app) and in the case of parcels, the number of popups could get annoying to the person looking at the map. Might work better with point data.
>
> Len
>
> -----Original Message-----
> From: Brent Fraser [mailto:bfraser at geoanalytic.com]<mailto:[mailto:bfraser at geoanalytic.com]>
> Sent: Thursday, June 03, 2010 10:05 AM
> To: Len Kne
> Cc: Geomooselist
> Subject: Re: [Geomoose-users] Mouseover map area to show pop up or link
>
> Len,
>
> That's impressive! How's the performance?
>
> Brent
>
> Len Kne wrote:
> > 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]<mailto:[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> <mailto:Bob.Basques at ci.stpaul.mn.us>
> > To: bfraser at geoanalytic.com<mailto:bfraser at geoanalytic.com> <mailto:bfraser at geoanalytic.com>;
> > franzzoa at hotmail.com<mailto:franzzoa at hotmail.com> <mailto:franzzoa at hotmail.com>
> > CC: geomoose-users at lists.sourceforge.net<mailto: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%0b>> > <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>
> > <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>
> > <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/>
> >
> >
> > ----------------------------------------------------------------------
> > --
> >
> > ----------------------------------------------------------------------
> > -------- 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
>
>
> ------------------------------------------------------------------------------
> 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/20100610/25a11591/attachment.html


More information about the Geomoose-users mailing list