Javascript SetMapView() trick doesn't work in 1.0.0.6

Last post 4/3/2008 3:31:40 AM by Chris Pietschmann. 3 replies. << Back to Web.Maps.VE v1.0 General
3/13/2008 10:17:12 PM
drfonz

Javascript SetMapView() trick doesn't work in 1.0.0.6

I've had a site that uses the sample code in this forum to select the best view possible around a number of shapes. This has worked fine until I upgraded the component from 1.0.0.4 to 1.0.0.6. Now, when the OnClientLoaded event is fired, there are no shapes in the Map Control, and so the view is not the desired one.

The shapes are actually drawn on the control successfully, which makes me think that OnClientLoaded is called when the map has finished loaded, but BEFORE any shapes are drawn on it. In order to test this theory I put an "alert" in the Javascript code and sure enough, it popped up after the map finished drawing, but before the shapes appeared on it!

Has this change been implemented on purpose? And if so, how can we now optimise the map view without any reference to what shapes are contained within it?

Thanks!
AL
3/14/2008 3:06:24 AM
Chris Pietschmann

Re:Javascript SetMapView() trick doesn't work in 1.0.0.6

This is a side-effect of the change that was made to fire the  OnClientMapLoaded event during the Virtual Earth MapLoaded Event (in v1.00.06) instead of immediately after Virtual Earth is told to load the map (in v1.00.04).

When OnClientMapLoaded is called immediately after Virtual Earth it told to load the map (in v1.00.04), depending on how fast the web browser executes the JavaScript code, it may end up executing the OnClientMapLoaded event before the VEMap has finished loading everything.

By calling OnClientMapLoaded during the Virtual Earth MapLoaded Event (in v1.00.06) we can make sure that the VEMap has finished loading everything before we execute the OnClientMapLoaded event. This eliminates a timing issue that can cause errors.

The problem you described is a side-effect being caused by a timing issue of Virtual Earth calling its MapLoaded event before Web.Maps.VE has finished loading all the Shapes on the map.

This issue will be fixed in the next update to the control. Thanks.

3/14/2008 8:57:10 AM
drfonz

Re:Javascript SetMapView() trick doesn't work in 1.0.0.6

Chris,

Any idea when this next revision will take place? 1.0.0.4 caused IE7 to throw errors when executing the SetMapView() if there were too many shapes (timing issue, again?) and 1.0.0.6 fixed this, but then it introduced this other "feature", so I really could do with a version that resolves both issues at the same time :)

Regards,
AL
4/3/2008 3:31:40 AM
Chris Pietschmann

Re:Javascript SetMapView() trick doesn't work in 1.0.0.6

We are looking to get the v1.00.07 update release out within the next couple weeks. Please look to the Roadmap page for the latest information regarding new updates.