ST_Weights — Returns the weight array of a rational NURBS curve.
float8[] ST_Weights(geometry nurbscurve);
Returns the weight values of a rational NURBS curve as an array of double precision values. Weights control the influence of each control point on the curve shape. Higher weights pull the curve closer to the corresponding control point.
Returns NULL if the curve has no weights (non-rational B-spline) or if the input is NULL. Raises an error if the input is not a NURBS curve.
Availability: 3.7.0
This example returns weights from a rational NURBS curve.
SELECT ST_Weights(ST_MakeNurbsCurve(2, 'LINESTRING(0 0, 5 10, 10 0)'::geometry, ARRAY[1.0, 2.0, 1.0]));
{1,2,1}
This example checks the weights of a non-rational curve.
SELECT ST_Weights('NURBSCURVE(2, (0 0, 5 10, 10 0))'::geometry);
null