Partager via


Toggling 3D Weather in the Virtual Earth AJAX Control

I had a few inquiries as to how one could programmatically turn weather off in the Virtual Earth AJAX Control. Didn’t know there was weather? Yes, turn on 3D by clicking the “3D” button on your favorite Virtual Earth web site (such as Live Search Maps). Once you get down to a particular zoom level you’ll see the clouds appear (given it’s a cloudy day in the respective city). In fact, we improved the cloud presentation in our latest release last week, see “Virtual Earth API Release Information, April 2009” for more information about the release.

image

We built a checkbox in the Live Search Maps 3D settings that allows you to disable weather. So, go to Live Search Maps, click options, then click 3D settings and you’ll see a check box for enabling/disabling weather.

But, what about the API? Well, there’s currently no supported way to do this so I’m gonna give you a bit of a hack; but, for those of you who deal with the situation of weather just getting in the way of your data visualization, you’ll appreciate this and it will be worth the risk (as minimal as it is). The following code will turn off weather:

function VEWeather (bOff)

{

var control3D = map.vemapcontrol.Get3DControl();

control3D.ShowLocalWeather = bOff;

}

image

That’s it. You can now add your own weather button to toggle between weather on, weather off….weather on, weather off, weather on…

CP