Interpolation is the process of using known points in a geometry to approximate unknown points.
Several spatial methods and predicates use interpolation when the calculations involve circular arcs. Interpolation turns a circular arc into a sequence of straight lines. For example, a circularstring representing a quarter arc might be interpolated as a linestring with 11 control points.
In Interactive SQL, connect to the sample database execute the following statement to create a variable called arc in which you will store a circularstring:
CREATE VARIABLE arc ST_CircularString;
Execute the following statement to create a circularstring and store it in the arc variable:
SET arc = NEW ST_CircularString( 'CircularString( -1 0, -0.707107 0.707107, 0 1 )' );
Execute the following statement to temporarily set the relative tolerance to 1% using the st_geometry_interpolation option.
SET TEMPORARY OPTION st_geometry_interpolation = 'relative-tolerance-percent=1';
Setting relative tolerance to 1% is optional, but makes the effects of interpolation more visible for the purposes of this example.
Open the Spatial Viewer (in Interactive SQL, click ) and execute the following query to view the circularstring:
SELECT arc UNION ALL SELECT arc.ST_CurveToLine() UNION ALL SELECT arc.ST_CurveToLine().ST_PointN( row_num ) FROM RowGenerator WHERE row_num <= arc.ST_CurveToLine().ST_NumPoints();
Notice how the arc is broken into a sequence of linestring. Since relative tolerance was set to 1%, each line segment shows up as a line that bows in from the true arc. The maximum distance between the interpolated line string and the true arc is 1% of the radius of the arc.