LineString or MultiLineString and must have the same SRID.
The result is a GeometryCollection containing exactly two MultiLineString elements:
- Element 0 contains paths traversed in the same direction by both inputs.
- Element 1 contains paths traversed in opposite directions.
A. If the inputs share no path, including when they intersect only at points, both elements are empty.
Signatures
Parameters
Geometry
required
The first
LineString or MultiLineString, which determines the direction of returned paths.Geometry
required
The second
LineString or MultiLineString, with the same SRID as A.Return type
A
GeometryCollection of same-direction and opposite-direction paths, or NULL if either input is NULL.A and B can therefore change which element contains a shared path.
Visual examples
Same and opposite directions
InputB first follows A, leaves it, and later traverses another part of A backwards. The
single result therefore populates both direction buckets. Notice that the path in element 1 is
reoriented to follow A, even though B traverses it in the opposite direction.
Multipart input and noded output
InputA can be a MultiLineString. In this example, B shares part of two different components
of A. The vertex at (90 161) belongs to B and splits the shared diagonal into two paths in
element 0.
Point-only intersections
Crossing at an interior point and touching at an endpoint are both zero-dimensional contacts. Neither is a shared path, so bothMultiLineString elements are empty.
Examples
Same direction
Both inputs traverse the shared interval from left to right, so it appears in element 0.Opposite direction
The second input traverses the shared interval in reverse, so it appears in element 1. Its returned coordinates still followA.

