[mapguide-users] RE: ZoomToView function breaks session

Martin Morrison martin.morrison at edsi.com
Wed Mar 16 11:34:31 EDT 2011


Steve and I have been working on this.  In a nutshell, we are creating a page that displays in the task frame where the user can enter into a form values from various coord systems.  The form will then convert the coordinate system to the current map and then zoom to that point at a certain zoom scale.  When we do this the map zooms to the correct location, but anything after is broken as if the session has been lost.   I have simplified the page as much as possible to show the exact issue.  The hard coded coords below are in the same projection the map is in and the scale is valid.  This is with the AJAX viewer.

<html>
<head>
<script language="Javascript">
                function MyZoomToCoord(){
                                parent.parent.ZoomToView("11516002.190242026", "3400692.2790488531", 2000.0, true);
                                parent.parent.refresh();
                }
</script>
</head>
<body>
<form>
                <input type="button" id="Submit" width="250" height="75" onclick="MyZoomToCoord();" value="Zoom to Coordinate">
</form>
</body>
</html>

The result is, the map zooms correctly to the point at the correct scale.  Then the user tries to do anything else and it fails, e.g. pan using the mouse, the map moves, then the screen goes blank.

Any thoughts?  Is this a bug in the core code?

Mapguide 2.2 RC2/Apache/W2003k/AJAX viewer.

Martin Morrison
Application Engineer
Engineering Design Systems, Inc.
3780 Peters Creek Rd Ext SW
Roanoke, VA  24018
540.345.1410
gis.edsi.com

From: mapguide-users-bounces at lists.osgeo.org [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Steve Finch
Sent: Monday, March 14, 2011 4:41 PM
To: mapguide-users at lists.osgeo.org
Subject: [mapguide-users] ZoomToView function breaks session

Hi all,

I'm new to the MapGuide list, but have been working some with MapGuide for the past couple of years and reading a lot here.  I'm testing a new PHP utility using MGOS 2.2 RC2 with the Ajax viewer.

The code I'm writing allows a user to zoom to a given location by typing in a coordinate in the local projected coordinate system, or optionally using LL (WGS84).  I think I'm on track with everything except that the Main frame ZoomToView() function seems to break my session.  After my code does the ZoomToView, the session is broken for any other operation until a browser refresh.

If I hard-code a similar ZoomToView function as a custom command in MapGuide Studio using InvokeScript, it works fine and the session continues normally.  It appears as though this has something to do with calling the function from a different frame.

The command executes in the Task view pane and I'm calling ZoomToView() from there as follows:

...
function GetParent()
        {
            if(popup)
                return opener;
            else
                return parent.parent;
        }

function ZoomToCoord(){
GetParent().ZoomToView(document.getElementById('ProjectedX').value, document.getElementById('ProjectedY').value, 2000.0, true);
}

The zoom works correctly, but then I get an error in the browser with any subsequent operation.

For example, using the scroll wheel to zoom results in this error message in the browser:

Message: Invalid argument.
Line: 3856
Char: 9
Code: 0
URI: http://gisvr1/mapguide/mapviewerajax/mapframe.php?MAPDEFINITION=Library%3A%2F%2FCounty%2FCounty_Premium_GIS_SQL.MapDefinition&TYPE=HTML&SHOWLEGEND=1&SHOWPROP=1&INFOWIDTH=240&LOCALE=en&HLTGT=2&HLTGTNAME=&SHOWSLIDER=1&SESSION=86b0a858-4e79-11e0-8000-0003ffca20da_en_C0A8C8D2591C591B591A

Since nothing else appears to be wrong and my session is dead, I assume this is indicating the expired session.

Thanks for any ideas.

Steve Finch
Engineering Design Systems, Inc.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20110316/664709ef/attachment.html


More information about the mapguide-users mailing list