Infrastructure Map Server Developer

Infrastructure Map Server Developer

Reply
*nick
Message 1 of 3 (155 Views)

Loading layout and automatically running zoom script

155 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 (155 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: 284
Registered: ‎10-06-2008
Message 3 of 3 (155 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
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!