You can create and query parametric circles, ellipses, or wedges in ST_Geometry columns using the ST_Geometry function.
Parametric circles, ellipses, and wedges are polygons that are defined by specific parameters, such as coordinate values, angles, and radii. The database stores these parameters instead of specific vertices and lines. By storing the parameters that define the shape, parametric shapes can be more accurate and use less storage space than storing them as many-sided polygon representations. The use of parametric shapes also allows the inclusion of z-coordinate and measure (m)-value parameters.
Seven parameters are expected when creating a circle:
- An x-coordinate value of the center point of the circle
- A y-coordinate value of the center point of the circle
- A z-coordinate value of the center point of the circle
- An m-value
- The radius of the circle to be created
- The number of points used to define the circle
The minimum number of points you can specify is 9. If you do not specify a number of points, 50 are used by default. These points are not stored with the shape but are generated when the circle is generated to validate the shape.
- The spatial reference ID (SRID) used to place the circle in space
Nine parameters are expected when creating an ellipse:
- An x-coordinate value of the center point of the ellipse
- A y-coordinate value of the center point of the ellipse
- A z-coordinate value of the center point of the ellipse
- An m-value
- The semimajor axis of the ellipse
The semimajor axis is the longest radius of an ellipse. The value specified for the semimajor axis must be greater than the semiminor axis.
- The semiminor axis of the ellipse
The semiminor axis is the shortest radius of an ellipse. The value specified for the semiminor axis must be greater than 0.0.
- The angle of rotation of the ellipse
The value specified for the angle of rotation is specified in degrees and must be greater than 0.0 but less than 360. Rotation is in a clockwise direction.
- The number of points used to define the ellipse
The minimum number of points you can specify is 9. If you do not specify a number of points, 50 points are used by default. These points are not stored with the shape but are generated when the ellipse is generated to validate the shape.
- The SRID used to place the ellipse in space
Ten parameters are expected when creating a wedge:
- An x-coordinate value of the center point of the circle that defines the wedge
- A y-coordinate value of the center point of the circle that defines the wedge
- A z-coordinate value of the center point of the circle that defines the wedge
- An m-value
- The start angle of the wedge
The start angle defines the beginning of the wedge as the number of degrees measured counterclockwise from 0 degrees.
- The end angle of the wedge
The end angle defines the end of the wedge as the number of degrees measured counterclockwise from 0 degrees.
- The outer radius
The outer radius defines the distance from the center of a circle to the outermost point of the wedge.
- The inner radius
The inner radius defines the distance from the center of a circle to the innermost point of the wedge, thereby defining the start of the wedge. If the inner radius is 0, the shape is a simple wedge.
If the inner radius is greater than 0, the wedge is technically an arcband.
- The number of points used to define the wedge
The minimum number of points you can specify is 9. If you do not specify a number of points, 80 points are used by default. These points are not stored with the shape but are generated when the wedge is generated to validate the shape.
- The SRID used to place the wedge in space
All radii, including the semimajor and semiminor axes and inner and outer radii, are defined in the units determined by the coordinate reference specified with the SRID.
See the ST_Geometry function for syntax and examples to create a parametric circle, ellipse, or wedge.