ST_Ellipse function
The ST_Ellipse function gives users the ability to create an ellipse with a specified center, axis, and tilt.
This function only takes coordinate values for the center point, not a points geometry.
Syntax
Parameter
- x
- A double precision value representing the longitude of a point.
- y
- A double precision value representing the latitude of a point.
- a
- A double precision value representing the length of the semi-major axis.
- b
- A double precision value representing the length of the semi-minor axis.
- tilt
- A double precision value representing the major axis tilt.
- segments
- An integer value that identifies the number of segments, which determine the number of
coordinates that represent the ellipse. If the segments parameter is omitted,
32is used as the default value. - unit-of-measure
- A VARCHAR(128) value that identifies the linear unit in which the axis length is measured. The
supported units of measure are listed in the SYSGEO.ST_UNITS_OF_MEASURE catalog view. If the
unit_of_measure parameter is omitted, METER will be used.Note: Angular units of measure are not supported.
- srs_id
- A value of type INTEGER that identifies the spatial reference system for the resulting geometry.
If the srs_id parameter is omitted, the spatial reference system with the numeric identifier
4326is used implicitly.If srs_id does not identify a spatial reference system listed in the catalog view SYSGEO.ST_SPATIAL_REFERENCE_SYSTEMS, then an exception condition is raised (SQLSTATE 38SU1).
Return type
ST_Polygon
Examples
- Example 1:
- Create an ellipse based on a location of x=1.0, y=1.0, a semi-major axis of 40 miles, a
semi-minor axis of 0.2 miles in WGS84= srs_id
4326:
values st_astext(ST_Ellipse(1.0, 1.0, 40.0, 0.4, 0.2, 32, 'mile', 4326)Result:POLYGON ((1.578363650 1.001980854, 1.029019501 1.005916276, 1.013938700 1.005869034, 1.008634678 1.005851460, 1.005763166 1.005841738, 1.003844232 1.005835159, 1.002375454 1.005830080, 1.001130247 1.005825744, 0.999979811 1.005821713, 0.998829375 1.005817659, 0.997584168 1.005813245, 0.996115391 1.005808002, 0.994196458 1.005801096, 0.991324949 1.005790639, 0.986020935 1.005770941, 0.970940174 1.005712205, 0.421637061 0.997916585, 0.970980603 0.994083466, 0.986061350 0.994130906, 0.991365353 0.994148517, 0.994236854 0.994158252, 0.996155781 0.994164836, 0.997624554 0.994169918, 0.998869757 0.994174256, 1.000020189 0.994178287, 1.001170621 0.994182340, 1.002415823 0.994186753, 1.003884595 0.994191993, 1.005803521 0.994198893, 1.008675021 0.994209337, 1.013979016 0.994228999, 1.029059725 0.994287536, 1.578363650 1.001980854))
- Example 2:
-
Create an ellipse with 36 segments and the spatial reference id:
values st_astext(ST_Ellipse(1.0, 2.0, 100.0, 40.0, 20.0, 36, 'mile', 1)Result:POLYGON ((2.359778 2.497169, 2.164547 2.675692, 1.872654 2.736089, 1.611763 2.733034, 1.406486 2.707963, 1.245028 2.676996, 1.113095 2.645034, 1.000000 2.613066, 0.898186 2.580721, 0.802026 2.547045, 0.706852 2.510652, 0.608203 2.469586, 0.501162 2.420938, 0.379706 2.360109, 0.236287 2.279432, 0.063094 2.165919, -0.138599 1.999603, -0.323490 1.764657, -0.358959 1.501695, -0.163594 1.323472, 0.128124 1.263438, 0.388779 1.266730, 0.593862 1.291930, 0.755172 1.322962, 0.886993 1.354953, 1.000000 1.386929, 1.101743 1.419268, 1.197843 1.452927, 1.292967 1.489292, 1.391574 1.530318, 1.498584 1.578907, 1.620023 1.639654, 1.763455 1.720209, 1.936717 1.833543, 2.138599 1.999603, 2.323867 2.234269, 2.359778 2.497169))
- Example 3:
- Create an ellipse with the default values of 32 segments, distances measured in METER, in
spatial reference system id
4326:
values st_astext(ST_Ellipse(1.0, 2.0, 100.0, 40.0, 20.0)Result:POLYGON ((1.000844651 2.000309309, 1.000701545 2.000428312, 1.000498285 2.000459387, 1.000328336 2.000450533, 1.000199520 2.000430489, 1.000099295 2.000408266, 1.000016747 2.000385914, 0.999944409 2.000363389, 0.999877029 2.000339928, 0.999810423 2.000314324, 0.999740618 2.000284797, 0.999663103 2.000248534, 0.999572128 2.000200740, 0.999460644 2.000132787, 0.999324799 2.000029660, 0.999188945 1.999874403, 0.999155349 1.999690691, 0.999298455 1.999571687, 0.999501715 1.999540613, 0.999671664 1.999549467, 0.999800480 1.999569511, 0.999900705 1.999591734, 0.999983253 1.999614086, 1.000055591 1.999636611, 1.000122971 1.999660072, 1.000189577 1.999685676, 1.000259381 1.999715203, 1.000336897 1.999751466, 1.000427871 1.999799260, 1.000539356 1.999867213, 1.000675201 1.999970340, 1.000811055 2.000125597, 1.000844651 2.000309309))
