File Exchange

image thumbnail

circlem

version 1.2.0.0 (140 KB) by Chad Greene
Draw circles on maps

18 Downloads

Updated 15 Oct 2014

View License

Drawing a circle of a given radius on a map using Matlab's built-in functions is surprisingly unintuitive. So when there's some sort of outbreak or nuclear threat emanating from a city and you need to make a fear-mongering map on the double, simply type circlem(lat,lon,radius) to instantly depict the imminent danger facing everyone inside the circle.
Syntax
circlem(lat,lon,radius)
circlem(...,'units',LengthUnit)
circlem(...,'PatchProperty',PatchValue)
h = circlem(...)
[h,circlelat,circlelon] = circlem(...)
Description
circlem(lat,lon,radius) draws a circle or circles of radius or radii given by radius centered at lat, lon, where radius, lat, and lon may be any combination of scalars, vectors, or MxN array. All non- scalar inputs must have matching dimensions.

circlem(...,'units',LengthUnit) specifies a length unit of input radius. See validateLengthUnit for valid units. Default unit is kilometers.

circlem(...,'PatchProperty',PatchValue) specifies patch properties such as edgecolor, facecolor, facealpha, linewidth, etc.

h = circlem(...) returns the patch handle of plotted circle(s).

[h,circlelat,circlelon] = circlem(...) also returns arrays of latitudes and longitudes corresponding to the outline of each circle drawn. Each "circle" is in actuality a polygon made of 100 lat/lon pairs.

Comments and Ratings (6)

Ted Shultz

So much easier than MATLAB's built in functions, thanks!

Nero Liu

Oscar

Chad Greene

Stephen: This function plots circles on *maps* in georeferenced (lat,lon) coordinates. The inbuilt rectangle function does not properly place circles in geographic coordinates. Further, the inbuilt rectangle function does not have the capability to calculate the lat,lon coordinates of a circle of a given radius. The circlem function makes it easy for users to enter center lat,lon location(s) and radius or radii in kilometers or miles, and circles are plotted properly.

MATLAB also has inbuilt circle and ellipse drawing using the |rectangle| function:

http://matlab.wikia.com/wiki/FAQ#How_do_I_create_a_circle.3F

http://www.mathworks.com/help/matlab/ref/rectangle.html

Updates

1.2.0.0

Expanded function header/help.

1.1.0.0

link to related FEX submissions

MATLAB Release Compatibility
Created with R2012b
Compatible with any release
Platform Compatibility
Windows macOS Linux

circlem/html/