This topic describes the ST_SharedPaths function. This function returns a collection of paths that are shared by two input geometry objects.
Syntax
geometry ST_SharedPaths(geometry lineal1 , geometry lineal2);
Parameters
Parameter | Description |
---|---|
lineal1 | The shared path 1. |
lineal2 | The shared path 2. |
Description
- The objects in the same direction are in the first element of the returned collection, and the objects in the opposite direction are in the second element of the returned collection.
- The direction of paths in the returned collection is based on the direction of the first input geometry object.
Examples
Results returned by using the default parameter settings:
select ST_AsText(ST_GeometryN(g,1)),ST_AsText(ST_GeometryN(g,2)) from (select ST_SharedPaths('LINESTRING(-1 0,0 0,0 1)'::geometry,'LINESTRING(0 0,0 1,1 1)'::geometry) as g) as t;
st_astext | st_astext
----------------------------+-----------------------
MULTILINESTRING((0 0,0 1)) | MULTILINESTRING EMPTY
(1 row)