Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.ocient.com/llms.txt

Use this file to discover all available pages before exploring further.

LINESTRING constructors use geospatial data to create a LINESTRING object.

ST_LINEFROMTEXT

Alias for ST_LINESTRING(CHAR). Creates a LINESTRING from a specified CHAR. The CHAR must be a LINESTRING value in WKT format. Syntax
SQL
ST_LINEFROMTEXT(char)
ArgumentData TypeDescription
charCHARA character value in WKT format to be used to create a LINESTRING.
Example
SQL
SELECT ST_LINEFROMTEXT('LINESTRING(1 2)');
Output: LINESTRING(1.000000 2.000000)

ST_LINEFROMWKB

Alias for ST_LINESTRING(BINARY). Creates a LINESTRING from the specified BINARY. The BINARY value must be a LINESTRING in WKB format. Syntax
SQL
ST_LINEFROMWKB(binary)
ArgumentData TypeDescription
binaryBINARYA binary value in WKB format to be used to create a LINESTRING.
Example
SQL
SELECT ST_LINEFROMWKB(
        BINARY(
'0x010200000002000000000000000000f03f000000000000004000000000000008400000000000001040'
        )
    );
Output: LINESTRING(1 2,3 4)

ST_LINEFROMEWKT

Creates a LINESTRING from the specified CHAR. The CHAR value must be a LINESTRING in EWKT format. ST_LINEFROMEWKT is functionally the same as ST_LINESTRING(CHAR). The input string must include an SRID=…​; value. However, the database ignores this component as all geography types are SRID 4326. Syntax
SQL
ST_LINEFROMEWKT('SRID=value;char')
ArgumentData TypeDescription
charCHARA LINESTRING value in WKT format to be used to create a LINESTRING.
To function properly, you must prefix this argument with an SRID value in the same string.
valueINTEGERAny integer value. This is required, however, the database ignores this component and defaults to SRID 4326.
Example
SQL
SELECT ST_LINEFROMEWKT('SRID=4326;LINESTRING(1 2)');
OutputLINESTRING(1.000000 2.000000)

ST_LINEFROMGEOJSON

Creates a LINESTRING represented by the specified GeoJSON. The specified GeoJSON can represent a GeoJSON POINT or LINESTRING type. Valid GeoJSON formats follow standards, and you can generate them by using ST_ASGEOJSON. If you specify an invalid GeoJSON, the behavior of the function is undefined. Syntax
SQL
ST_LINEFROMGEOJSON(geojson [, geodesic ])
ArgumentData TypeDescription
geojsonCHARA GeoJSON value that represents a POINT or LINESTRING type that is used to create a LINESTRING.
If geojson is NULL, the function returns NULL.
geodesicBOOLEANOptional. A BOOLEAN value that determines if the specified geojson should be converted from a planar to a geodesic representation.
If you specify geodesic as TRUE, the function adds points to the resulting LINESTRING such that it remains within 10 meters of the original planar line.
If unspecified, geodesic defaults to FALSE.
If geodesic is NULL, the function returns NULL.
Examples In this example, the function converts an empty GeoJSON value of a LINESTRING.
SQL
SELECT ST_LINEFROMGEOJSON('{"type":"LineString","coordinates":[]}',false);
Output: LINESTRING EMPTY In this example, the function converts a GeoJSON value of a LINESTRING.
SQL
SELECT ST_LINEFROMGEOJSON(
        '{"type":"LineString","coordinates":[[1,1],[1,5],[5,5],[5,1]]}',
        false);
Output: LINESTRING(1 1, 1 5, 5 5, 5 1)

ST_LINESTRING

Alias for ST_MAKELINE. Creates a LINESTRING based on the specified inputs.

ST_LINESTRING(geoArray) [#st_linestring-geoarray]

Creates a LINESTRING from the specified array of either LINESTRING or POINT values. Syntax
SQL
ST_LINESTRING(geo_array)
ArgumentData TypeDescription
geo_arrayARRAY of geographies, either LINESTRING or POINT values.An array of LINESTRING or POINT values to be used to create a unified LINESTRING.
Example
SQL
SELECT ST_LINESTRING(
        ST_LINESTRING [](ST_LINESTRING(ST_POINT(1, 2), ST_POINT(3, 4))));
Output: LINESTRING(1.000000 2.000000, 3.000000 4.000000)

ST_LINESTRING(binary)

Creates a LINESTRING from the specified BINARY. The BINARY value must be a LINESTRING in WKB format. Syntax
SQL
ST_LINESTRING(binary)
ArgumentData TypeDescription
binaryBINARYA BINARY value to be used to create a LINESTRING. The BINARY value must be a LINESTRING in WKB format.
Example
SQL
SELECT ST_LINESTRING(BINARY('0x010200000002000000000000000000f03f000000000000004000000000000008400000000000001040'));
OutputLINESTRING(1 2,3 4)

ST_LINESTRING(char) [#st_linestring-char]

Creates a LINESTRING from the specified CHAR. The CHAR value must be a LINESTRING in WKT format. Syntax
SQL
ST_LINESTRING(char)
ArgumentData TypeDescription
charCHARA CHAR value to be used to create a LINESTRING. The argument must be a LINESTRING in WKT format.
Example
SQL
SELECT ST_LINESTRING('LINESTRING(1 2)');
OutputLINESTRING(1.000000 2.000000)

ST_LINESTRING(geo1, geo2) [#st_linestring-geo1-geo2]

Creates a LINESTRING consisting of two separate geographic arguments, both of which must be either a POINT or LINESTRING. You can mix geographic types, meaning one argument can be a POINT while the other is a LINESTRING. Syntax
SQL
ST_LINESTRING(geo1, geo2)
ArgumentData TypeDescription
geo1, geo2POINT or LINESTRINGTwo separate geographic arguments to be consolidated into a single LINESTRING.

Inputs can be the same type or one of each.
Example
SQL
SELECT ST_LINESTRING(ST_POINT(1, 2), ST_POINT(1,3));
OutputLINESTRING(1.000000 2.000000, 1.000000 3.000000)

ST_MAKELINE

Alias for ST_LINESTRING.

ST_MAKELINE(geo1, geo2)

Alias for ST_LINESTRING(geo1, geo2).

ST_MAKELINE(CHAR)

Alias for ST_LINESTRING(char).

ST_MAKELINE(geoArray)

Alias for ST_LINESTRING(geoArray). Geospatial Data Types Linestring Functions Conversion Functions
Last modified on May 21, 2026