SQL Reference
Geospatial Functions

Linestring Constructors

{{ocientgeo}} 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 st linefromtext(char) argument data type description char char a character value in wkt format to be used to create a linestring example 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 st linefromwkb(binary) argument data type description binary binary a binary value in wkb format to be used to create a linestring example 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 {{ocient}} geography types are srid 4326 syntax st linefromewkt('srid=value;char') argument data type description char char a 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 value integer any integer value this is required, however the database ignores this component and defaults to srid 4326 example select st linefromewkt('srid=4326;linestring(1 2)'); output linestring(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 ietf standards , and you can generate them by using conversion functions docid\ v8siabihllvnshu2phqcu if you specify an invalid geojson, the behavior of the function is undefined syntax st linefromgeojson(geojson \[, geodesic ]) argument data type description geojson char a geojson value that represents a point or linestring type that is used to create a linestring if geojson is null, the function returns null geodesic boolean optional 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 select st linefromgeojson('{"type" "linestring","coordinates" \[]}',false); output linestring empty in this example, the function converts a geojson value of a linestring 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) creates a linestring from the specified array of either linestring or point values syntax st linestring(geo array) argument data type description geo array array of geographies, either linestring or point values an array of linestring or point values to be used to create a unified linestring example 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 st linestring(binary) argument data type description binary binary a binary value to be used to create a linestring the binary value must be a linestring in wkb format example select st linestring(binary('0x010200000002000000000000000000f03f000000000000004000000000000008400000000000001040')); output linestring(1 2,3 4) st linestring(char) creates a linestring from the specified char the char value must be a linestring in wkt format syntax st linestring(char) argument data type description char char a char value to be used to create a linestring the argument must be a linestring in wkt format example select st linestring('linestring(1 2)'); output linestring(1 000000 2 000000) 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 st linestring(geo1, geo2) argument data type description geo1 , geo2 point or linestring two separate geographic arguments to be consolidated into a single linestring inputs can be the same type or one of each example select st linestring(st point(1, 2), st point(1,3)); output linestring(1 000000 2 000000, 1 000000 3 000000) st makeline alias for linestring constructors docid 2iwjvyv2kyrmbibjaqy6b st makeline(geo1, geo2) alias for linestring constructors docid 2iwjvyv2kyrmbibjaqy6b st makeline(char) alias for linestring constructors docid 2iwjvyv2kyrmbibjaqy6b st makeline(geoarray) alias for linestring constructors docid 2iwjvyv2kyrmbibjaqy6b related links data types docid\ salunscyvkcxpgzh3m0hd linestring functions docid 8u29wjyy9knfr6gked5la conversion functions docid\ v8siabihllvnshu2phqcu