circles-ellipses
Not logged in

back

New SQL functions supporting Circles and Ellipses introduced in 4.1.0

MakeCircle ( cx, cy, radius )
MakeCircle ( cx, cy, radius, srid )
MakeCircle ( cx, cy, radius, srid, step )
Will return a closed Linestring approximating a circle.
  • cx and cy are the coordinates identifying the centre.
  • both radius and srid are self-explanatory.
  • the optional argument step defines how many points will be interpolated on the curve. step corresponds to an angular distance measured in degrees; two consecutive points will be separated by this distance.
circle
SELECT MakeCircle(0, 0, 100, -1, 1);
MakeEllipse ( cx, cy, x_axis, y_axis )
MakeEllipse ( cx, cy, x_axis, y_axis, srid )
MakeEllipse ( cx, cy, x_axis, y_axis, srid, step )
Will return a closed Linestring approximating an ellipse.
  • cx, cy, srid and step have exactly the same identical meaning as before.
  • x_axis and y_axis define respectively the horizontal and vertical axes of the ellipse.
ellipse-1
SELECT MakeEllipse(0, 0, 100, 50,
    -1, 1);
ellipse-2
SELECT MakeEllipse(0, 0, 50, 100,
    -1, 1);
MakeArc ( cx, cy, radius, start, stop )
MakeArc ( cx, cy, radius, start, stop, srid )
MakeArc ( cx, cy, radius, start, stop, srid, step )
Will return a Linestring approximating a circular arc.
  • cx, cy, radius and step are exactly as above.
  • start and stop define the extreme points of the arc; both are angles expressed in degrees. The arc will be always drawn in counterclockwise direction.
arc-1
SELECT MakeArc(0, 0, 100, 
    30, 150, -1, 1);
arc-2
SELECT MakeArc(0, 0, 100, 
    30, 150, -1, 1);
MakeEllipticArc ( cx, cy, x_axis, y_axis, start, stop )
MakeEllipticArc ( cx, cy, x_axis, y_axis, start, stop, srid )
MakeEllipticArc ( cx, cy, x_axis, y_axis, start, stop, srid, step )
Will return a Linestring approximating an elliptic arc.
elliptic-arc-1
SELECT MakeEllipticArc(0, 0, 50, 100, 
    30, 150, -1, 1);
elliptic-arc-2
SELECT MakeEllipticArc(0, 0, 50, 100,
    150, 30, -1, 1);
MakeCircularSector ( cx, cy, radius, start, stop )
MakeCircularSector ( cx, cy, radius, start, stop, srid )
MakeCircularSector ( cx, cy, radius, start, stop, srid, step )
Will return a Polygon approximating a circular sector.
circular-sector-1
SELECT MakeCircularSector(0, 0, 100,
    330, 30, -1, 1);
circular-sector-2
SELECT MakeCircularSector(0, 0, 100,
    30, 330, -1, 1);
MakeEllipticSector ( cx, cy, x_axis, y_axis, start, stop )
MakeEllipticSector ( cx, cy, x_axis, y_axis, start, stop, srid )
MakeEllipticSector ( cx, cy, x_axis, y_axis, start, stop, srid, step )
Will return a Polygon approximating an elliptic sector.
elliptic-sector-1
SELECT MakeEllipticSector(0, 0, 100, 50,
    330, 30, -1, 1);
elliptic-sector-2
SELECT MakeEllipticSector(0, 0, 100, 50,
    30, 330, -1, 1);
MakeCircularStripe ( cx, cy, radius_1, radius_2, start, stop )
MakeCircularStripe ( cx, cy, radius_1, radius_2, start, stop, srid )
MakeCircularStripe ( cx, cy, radius_1, radius_2, start, stop, srid, step )
Will return a Polygon delimited by two circular arcs sharing the same centre but having different radii.
circular-stripe-1
SELECT MakeCircularStripe(0, 0, 100, 90,
    45, 315, -1, 1);
circular-stripe-2
SELECT MakeCircularStripe(0, 0, 50, 150,
    315, 45, -1, 1);
Any function supporting circles and ellipses could obviously be nested with any other Spatial SQL function so to get more elaborate results.
e.g. RotateCoords() and ShiftCoords() could be invoked in order to apply an arbitrary roto-translation.
tilt-ellipse
SELECT RotateCoords( MakeEllipse(0, 0, 100, 20, -1, 1), 45);


back