SQL Reference
Geospatial Functions
Linestring Functions
{{ocientgeo}} linestring functions can perform alterations or access descriptive information on linestring objects st addpoint adds a point to the given linestring at the specified 0 indexed location syntax st addpoint(geo linestring, geo point to add \[, location ] ) 159,142,350 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type example select st addpoint( st linestring('linestring(1 2, 1 3)'), st point(1, 4), 1\); output linestring(1 000000 2 000000, 1 000000 4 000000, 1 000000 3 000000) st endpoint returns the endpoint of a specified linestring the returned value is a point syntax st endpoint(geo) 160,150,350 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type example select st endpoint(st linestring('linestring(1 2, 1 3, 1 4)')); output point(1,4) st lineinterpolatepoint returns a point along a linestring based on a specified fraction of its total length syntax st lineinterpolatepoint(line, fraction) 130,166,350 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type example in this example, the function computes a point halfway (0 5) along the specified line select st lineinterpolatepoint(st linestring('linestring(1 2, 2 1)'), 0 5); output point(1 5 1 5) st linelocatepoint similar to docid waxmx64wjb9bhjibuf8b , this function computes a fraction based on where a specified point is located along the length of a specified linestring syntax st linelocatepoint(line, point) 113,169,350 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type example in this example, the function computes a fraction that represents where the point (1 5, 1 5) lies along the line select st linelocatepoint( st linestring('linestring(1 2, 2 1)'), st point(1 5, 1 5)); output 0 5 st linesubstring returns a linestring that is a substring of a specified line that starts and ends at the specified fractions of its total length syntax st linesubstring(line, start fraction, end fraction) 160,152,350 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type unhandled content type left unhandled content type left unhandled content type left unhandled content type example in this example, the function generates a subsection of the provided linestring, spanning from the start fraction value (0 5) that represents the halfway point of the original linestring, to the end fraction value (1 0) that represents the endpoint select st linesubstring(st linestring('linestring(1 2, 2 1)'), 0 5, 1 0); output linestring(1 50 1 50, 2 0 1 0) st pointn returns the point value at a specified index of the specified linestring if out of bounds, the function returns null syntax st pointn(geo, index) 160,140,350 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type unhandled content type example select st pointn( st linestring( st point \[]\(st point(1, 2), st point(1, 3), st point(1, 4))), 3\); output st point(1,4) st removepoint removes a point value at a specified index from the specified line syntax st removepoint(geo, index) 160,143,350 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type unhandled content type example select st removepoint(st linestring('linestring(1 2, 1 3, 1 4)'), 1); output linestring(1 0 2 0, 1 0 4 0) st setpoint replaces a point value in a specified linestring at a specified index the function returns the altered linestring with the replaced point syntax st setpoint(geo, index, geo point to replace) 202,122,273 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type unhandled content type left unhandled content type left unhandled content type left unhandled content type example in this example, the function replaces the point value located at the 2 index location, meaning it is the second from the last in the sequence select st setpoint( st linestring('linestring(1 2, 1 3, 1 4)'), 2, st point(1, 5)); output linestring(1 000000 2 000000, 1 000000 5 000000, 1 000000 4 000000) st startpoint returns the starting point value of the line if this value is empty, the function returns null if you specify a polygon , point , or null, then the function returns null if you specify a non geography value, the function throws an error syntax st startpoint(geo) 115,134,350 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type example select st startpoint(st linestring('linestring(1 2, 1 3, 1 4)')); output st point(1,2) related links docid\ czxgepf3prq9ufwhwbiuy docid\ ja2bwo8hlbgf8s2gffhvk