Infrastructure Map Server Developer

Infrastructure Map Server Developer

Reply
*nick
Message 1 of 3 (153 Views)

Loading layout and automatically running zoom script

153 Views, 2 Replies
01-19-2009 04:15 AM
I want to load a layout, and automatically zoom to a point on the layout.
If the script is set as a home task, it runs automatically the first time,
but not the second, as if it doesn't run if already in the browser cache.
If the script is loaded in the script frame, it only runs from a button
press, not automatically.
I have also tried modifying the ajaxviewer.aspx and mainframe.aspx to insert
string url = "
target=\"scriptFrame\">
";

Response.Write(url);

after the frameset is loaded.

It is still not zooming automatically, where am I going wrong?
*nick
Message 2 of 3 (153 Views)

Re: Loading layout and automatically running zoom script

01-20-2009 08:07 AM in reply to: *nick
There must be a way of setting the initial map center and zoom scale when
opening the map frame
It doesn't seem logical to open the map as set in the MapGuide Studio, then
zooming to the required point.



"nick" wrote in message
news:6107142@discussion.autodesk.com...
I want to load a layout, and automatically zoom to a point on the layout.
If the script is set as a home task, it runs automatically the first time,
but not the second, as if it doesn't run if already in the browser cache.
If the script is loaded in the script frame, it only runs from a button
press, not automatically.
I have also tried modifying the ajaxviewer.aspx and mainframe.aspx to insert
string url = " target=\"scriptFrame\"> ";

Response.Write(url);

after the frameset is loaded.

It is still not zooming automatically, where am I going wrong?
Valued Mentor
jackie.ng
Posts: 277
Registered: ‎10-06-2008
Message 3 of 3 (153 Views)

Re: Loading layout and automatically running zoom script

01-22-2009 05:21 PM in reply to: *nick
In the WebLayout, there are settings for controlling the initial view and scale.

What you can do is before you actually load the viewer to do the following:

1. Get the XML content of the WebLayout you want to load
2. Modify the XML content. Set the initial view and scale to the values you want.
3. Save the XML content into a temporary WebLayout (use the session repository)
4. Load your viewer, passing in the resource ID of the WebLayout for your WEBLAYOUT parameter

There's a PHP example here which can easily be converted to the language of your choice:

http://trac.osgeo.org/mapguide/wiki/CodeSamples/PHP/InitialMapView

- Jackie
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.