• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk MapGuide Enterprise Developer

    Reply
    *nick

    Loading layout and automatically running zoom script

    132 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?
    Please use plain text.
    *nick

    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?
    Please use plain text.
    Mentor
    Posts: 242
    Registered: ‎10-06-2008

    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
    Please use plain text.