[mapguide-users] Open map and zoom to feature?

Mark Pendergraft markp at Meadgilman.com
Wed Jan 28 12:26:20 EST 2009


function OnPageLoad()
{			
	var initTimer = setInterval(waitForMap, 200);
	
	// Wait for the map to be initialized.
	// When it is, open the second task pane.
	function waitForMap () 
	{
		try 
		{
			// The Refresh method will exist when the
			// map has been initialized.
			if (parent.parent.mapFrame.Refresh()) 
			{
				clearInterval(initTimer);
                		// Zoom to a Job if one was passed
                		ZoomToJobNo()
   				// Open the second task pane
				window.location =
"TasksOverview.aspx?<%=Parameters %>";
			}
		}
		catch(Exception){}
	}				
}

function ZoomToJobNo()
{
//your code to zoom goes here
}

This is the code that resides in my initial TaskPane page.  Once the map
comes up, this page attempts to zoom to a feature (job) and then loads a
different page in the TaskPane.

How your site is setup will determine how your code needs to be written.
You need to pass the necessary variables in from your URL to the
taskpane, and then use a script similar to this to wait until the map is
loaded.  Once the map is loaded you can zoom to a feature.

-Mark

-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of JamesDudden
Sent: Wednesday, January 28, 2009 8:43 AM
To: mapguide-users at lists.osgeo.org
Subject: RE: [mapguide-users] Open map and zoom to feature?




Mark Pendergraft wrote:
> 
> ...function into the taskpane that would loop continuously until the
> map.Refresh() function returned true.  Then I sent the feature...
> 

Mark,

I have now got a bodged version of the open-map-and-zoom function
working
using a hard-written feature value.  What I would like to do is a have
an
html page with list of values that a user can click to open the map to
that
specific feature.

I have tried passing the value using a session variable and writing it
in to
my filter but it doesn't work - I think this is a timing issue and
thought
your map.refresh function might help. Could you post the code and where
you
put the function?

Regards
James
-- 
View this message in context:
http://n2.nabble.com/Open-map-and-zoom-to-feature--tp2223369p2233257.htm
l
Sent from the MapGuide Users mailing list archive at Nabble.com.

_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users


More information about the mapguide-users mailing list