Circle around points

5/20/2013 3:24:21 PM
Total Posts 2

Circle around points

I would like to show a 1 mile radius around certain points (ie, a church, hospital, etc).  How can I do this?  I'd like the radius to display without the user having to draw the circles themselves.

 

 

5/20/2013 3:43:22 PM
MVP
Total Posts 323

Re: Circle around points

This can be done with the following code:

    map1.MapUnit = MeasureUnit.Degree;
double centerX = -78.78; // longitude
    double centerY = 38.73; // latitude
    AspMap.Shape circle = new Shape();
    double radius = map1.ConvertDistance(1, MeasureUnit.Mile, map1.MapUnit);
    circle.MakeCircle(centerX, centerY, radius);
    MapShape ms = map1.MapShapes.Add(circle);
    ms.Symbol.FillStyle = FillStyle.Invisible;
    ms.Symbol.LineColor = Color.Red;

The map1.MapUnit property should be set to the correct units of your map data, for example for shapefiles in WGS1984 (geographic) projection this will be MeasureUnit.Degree. The example above is for degrees.

5/20/2013 4:24:22 PM
Total Posts 2

Re: Circle around points

That works beautifully!  Thanks so much.