The v.mk_circle program is a simple GRASS utility to create a closed vector at a user defined location and size. The program was originally written to create a GRASS vector for target zones at a specific location. The v.mk_circle program has since been upgraded to output other shapes (see below), and accept multiple locations and sizes from an ASCII file or standard input.
The m.mk_circle program will accept a single coordinate and size from the command line, or a series of locations and sizes from a file or standard input. The following command argument are accepted:
-c Build shapes as closed centroids (solid). The default is an open vector with just the outline.
output The name of the output GRASS vector file
coordinate The comma separated coordinate (east,north) for the centre of the shape
radius The radius of the shape
shape The shape of the output GRASS vector. Options include: circle, octagon, hexagon, pentagon, diamond, and triangle (default = circle)
input The name of the ASCII input file with multiple coordinates (use "-" to read from stdin)
fs The field separator for the input file
The coordinate option and the input option cannot be used together. You must supply one or the other.
The input file must contain a minimum of 2 columns (east north) with an optional 3rd column containing the size of the shape. If the 3rd column is omitted the size id read from the radius argument.
in the GRASS Lat. Lon. projection the radius is converted to a true distance in metres using the G_distance library function. This can result in a circle appearing as an oval depending on the location on the globe.
v.mk_circle coordinate=517947,7855998 radius=200 output=Circle_Zone_200m
v.mk_circle coordinate=517947,7855998 radius=500 output=Circle_Zone_500m
Create a 3 column file (file_pts.txt) with easting, northing, and size:
516304 7856290 50
517399 7855925 65
517618 7855414 65.5
518057 7854391 75
516669 7854209 80
516961 7854903 88.9
Import the above file with the following command:
v.mk_circle -c input=file_pts.txt fs=space shape=triangle out=Triangles_Example2
The source code for v.mk_circle is freely available at this site. The source is provided for both the GRASS 6 and the GRASS 7 distributions.
Download them here:
- Extract the downloaded tarball in the vector folder of the GRASS source tree.
- Run make in the v.mk_circle folder to build the program and install in your GRASS distribution.
- Run the program from the GRASS command line prompt.
There are probably lots of other potential uses for this program. Future versions could include the following:
- support for creating more shapes
- support for importing other columns with vector attributes