Parametric circles and ellipses
You can create and query parametric circles and ellipses in ST_Geometry columns using the ST_Geometry function.
Parametric circles and ellipses 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 circles and ellipses can be more accurate and use less storage space than storing circles and ellipses as many-sided polygon representations. The use of parametric circles and ellipses also allows the inclusion of z-coordinate and m-value parameters.
Seven parameters are expected when creating a circle:
- An x-coordinate value of the center point
- A y-coordinate value of the center point
- A z-coordinate value of the center point
- A measure (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, the number 50 is used by default.
- 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
- A y-coordinate value of the center point
- A z-coordinate value of the center point
- 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, the number 50 is used by default.
- The SRID used to place the ellipse in space
Radii, including the semimajor and semiminor axes, 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 and ellipse.