[mapguide-users] RE: Bypassing initial view at startup

FGoulet gouletf at dfo-mpo.gc.ca
Tue Mar 27 15:57:05 EDT 2007


Thanks,

I will give it a try.




Nichols, Mark A. wrote:
> 
> Interesting, we're working on the same problem.  I have found an answer. 
> I hope it helps you.  Try these steps.
>  
> 1.  In MapGuide Studio, go to your web layout.  There is an area "URL for
> home task displayed in the Task Pane".  Change this to a new page.  In my
> case, I changed this to a page called ../gt/initial.php.
>  
> 2.  Create your page initial.php.
> 3.  Create a dummy page to set your variables in.  In my case, I'm getting
> my x and y in a seperate PHP program.  So I can set them as session
> variables and then retreive them in my initial.php page.
>  
> initial.php (the default page of the task pane)
> -------------------------------
> <?php
> session_start();
> $xLocation=$_SESSION["X"];;
> $yLocation=$_SESSION["Y"];
> $mapScale=$_SESSION["mapScale"];
> if ($xLocation=="")
> {
>  echo "No X,Y specified, continue with initial view.";  
> }
> else
> {
> ?>
>    
> <script language="javascript">
>  window.setTimeout("parent.parent.mapFrame.ZoomToView(<?php echo
> $xLocation; ?>, <?php echo $yLocation; ?>, <?php echo $mapScale; ?>,
> true)", 2000); 
> </script>    
> <?php
> }
> ?>
> 
> setvar.php (some other page where I'm setting variables for the map to
> use)
> -------------------------------
> <?php
> session_start();
> session_register("X");
> session_register("Y");
> session_register("mapScale");
> $_SESSION["X"]=656411;
> $_SESSION["Y"]=321285;
> $_SESSION["mapScale"]=15000;
> ?>
>  
> So the map opens, it starts to load with the initial zoom, but then the
> right frame quickly redirects it to the new coordinates.  I had to have
> the window.setTimeout to give the page a little delay, otherwise the
> script wouldn't work.
>  
> It's not the best logic, but it works.  Let me know if you have any
> problems with it.
>  
> Mark Nichols
> 
> ________________________________
> 
> From: mapguide-users-bounces at lists.osgeo.org on behalf of FGoulet
> Sent: Thu 3/22/2007 4:07 PM
> To: mapguide-users at lists.osgeo.org
> Subject: [mapguide-users] Bypassing initial view at startup
> 
> 
> 
> 
> Hi,
> 
> When the MapGuide Viewer start, is there a way to zoom to an extent other
> than what is it defined in the map layout initial view?
> 
> I know I can zoom after the map first apprears but I would really like to
> bypass the initial view for a better user experience.
> 
> Thanks
> --
> View this message in context:
> http://www.nabble.com/Bypassing-initial-view-at-startup-tf3450031s16610.html#a9623015
> 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
> 
> 
> 
>  
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> 
> 

-- 
View this message in context: http://www.nabble.com/Bypassing-initial-view-at-startup-tf3450031s16610.html#a9699892
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list