I get requests on how to draw radius’ around points on the map. And, up until now, I never needed to do it myself, so I didn’t have a code snippet to do it. I did a search and quickly found an example over at viavirtualearth on how to do it in an older version of Virtual Earth. Other than being coded for an older version of Virtual Earth (and incompatible with VE6); it’s coded to only handle drawing a radius in Kilometers.

So, I decided to upgrade the code example to support VE6, and support both Miles and Kilometers. I’m also converted it to make use of the GeoCodeCalc.ToDegrees function that I originally posted in my “Calculate Distance of User-Drawn Polyline” post.

And, in case you don’t feel like downloading the example code that uses it, here’s the source to the method that calculates the points that make up the radius:

`````` /* *************************************************************************** */
/* Written Chris Pietschmann (http://pietschsoft.com) */
/* This code is dependant on the GeoCodeCalc class found here: */
/* <a href="/Blog/Post.aspx?PostID=1453">/Blog/Post.aspx?PostID=1453</a> */
/* *************************************************************************** */
/* This mathimatical code is a modified version of the code originally posted */
/* at the following location: */
/* <a href="http://viavirtualearth.com/Wiki/Draw+a+circle.ashx">http://viavirtualearth.com/Wiki/Draw+a+circle.ashx</a> */
/* *************************************************************************** */
if (GeoCodeCalc == undefined)
var GeoCodeCalc = {}