[mapguide-users] Zoom to selection and set new scale

James Card James.Card at calcad.com
Mon Oct 22 11:58:54 EDT 2007


On Mon, 22 Oct 2007 08:45:22 -0700, ruivilanova <rui.vilanova at gismedia.pt>  
wrote:

> I'm selecting a point and then I zoom to it (with SetSelectionXML and  
> ExecuteMapAction(10) functions), but mapguide zooms to a scale of 0.01  
> because the selection is a point. I need to zoom to a bigger scale.
>
> If I do the following code, it zooms to the center of the map before do  
> ExecuteMapAction(10), not to the place I want. It seems that Refresh()  
> isn't working.
>
> function zoom2point(xml)
> {
>     parent.parent.SetSelectionXML(xml);
>     parent.parent.mapFrame.ExecuteMapAction(10);
>
>     parent.parent.mapFrame.Refresh();
>     parent.parent.Refresh();
>
>     var x= parent.parent.mapFrame.GetCenter().X;
>     var y= parent.parent.mapFrame.GetCenter().Y;
>     parent.parent.mapFrame.ZoomToView(x,y,2500,true);
> }	

Is it possible the Refresh hasn't completed yet when the code reaches your  
ZoomToView?

I usually resolve this by changing the minScale variable in  
ajaxmappane.templ, but this affects all applications on the server and  
gets overwritten when I installed a new version of MapGuide. The better  
way would be to override that function in code that loads separately.

-- 
James Card
209-578-5580


More information about the mapguide-users mailing list