English

# How To: Draw ground circles in an unprojected view.

## Summary

ArcView uses the Plate Carree projection in order to draw unprojected data to a flat monitor. This projection distorts shapes, directions and distances such that a graphic circle drawn in the view does not actually represent a true circle on the ground.

This article provides a script for creating circles within an unprojected view that contains theme data in decimal degrees. The script modifies the shape of the circle so that it actually represents a circle as it would exist on the ground.

## Procedure

1. Open a new script window.

A. Activate the Project window.
B. Click the Scripts icon.
C. Click New.

2. Copy the following code into the new script window.

`Code:'SCRIPT: "GROUNDCIRCLE.AVE" ' 'This script works on unprojected DD data 'in an unprojected view. It prompts the 'user for a Lat/Long coordinate and a radius 'in miles. It then produces a shape on the 'View that represents a true circle on the 'ground. The shape will most often NOT look 'like a circle on the View display due to the 'unprojected nature of the themes' source data 'and the Plate Carree projection used by ArcView 'to display unprojected data on a flat monitor. ' 'GET THE VIEW AND ITS GRAPHIC LIST theView = av.GetActiveDoc 'theView = av.GetProject.FindDoc("Name of View") 'OR theGraphicList = theView.GetGraphics 'ENSURE THE VIEW HAS NO PROJECTION if (theView.GetProjection <> "") then MsgBox.Warning ("Script only works on unprojected views.", "Stop") return nil end 'MAKE THE PROJECTION OBJECT theRect = Rect.MakeXY( -180, -90, 180, 90) thePrj = Sinusoid.Make(theRect) 'GET THE COORDS FROM THE USER TO DEFINE 'THE CENTER OF THE CIRCLE IN DECIMAL DEGREES pointCoords = MsgBox.MultiInput ("Enter X/Y in DD for center of point", "Create Ground Circle", {"Latitude/Ycoord: ", "Longitude/Xcoord: "}, {"40", "-120"}) 'CHECK TO ENSURE THAT THE ENTRIES ARE 'CONVERTABLE INTO NUMBERS if ((pointCoords.Get(0).IsNumber.Not) or (pointCoords.Get(1).IsNumber.Not)) then MsgBox.Warning("Incorrect entry","Stop") return nil end 'CONVERT THE ENTRIES INTO NUMBERS unprojCenterY = pointCoords.Get(0).AsNumber unprojCenterX = pointCoords.Get(1).AsNumber 'ENSURE THAT THE DD COORDINATES ENTERED 'ARE ON THE PLANET SOMEWHERE if ((unprojCenterX.Abs > 180) or (unprojCenterY.Abs > 90)) then MsgBox.Warning("One or more of the input coordinate"+NL+ "values is outside geographics space.", "Stop") return nil end 'RESET CENTRAL MERIDIAN OF SINUSOID PROJECTION OBJECT 'TO COINCIDE WITH THE CENTER OF THE USER'S CIRCLE thePrj.SetCentralMeridian(unprojCenterX) thePrj.Recalculate 'MAKE THE POINT, THEN PROJECT IT INTO SINUSOIDAL unprojCenter = Point.Make(unprojCenterX, unprojCenterY) projCenter = unprojCenter.ReturnProjected(thePrj) 'GET THE RADIUS FROM THE USER IN MILES radius = MsgBox.Input("Enter radius in miles:", "Create ground circle", "75") 'ENSURE THAT THE ENTRY CAN BE CONVERTED 'INTO A NUMBER if (radius.IsNumber.Not) then Msgbox.Warning("Incorrect entry.","Stop") return nil else radius = radius.AsNumber end 'CONVERT THE RADIUS FROM MILES INTO METERS radiusMeters = radius * 1609.347 'MAKE THE CIRCLE IN PROJECTED SPACE projCircle = Circle.Make(projCenter, radiusMeters) 'UNPROJECT THE CIRCLE unprojCircle = projCircle.ReturnUnprojected(thePrj) theGraphicCircle = GraphicShape.Make(unprojCircle) 'ADD THE CIRCLE TO THE VIEW'S GRAPHIC LIST theGraphicList.Add(theGraphicCircle) 'REDRAW THE VIEW theView.Invalidate ' 'END OF SCRIPT "GROUNDCIRCLE.AVE"`

3. Click the compile button.

4. Make the View window active.
5. Make the Script window active.
6. Click the run button.

7. The script will prompt for a latitude, longitude and radius value in miles.