ST_Crosses

Determines if one GEOMETRY object spatially crosses another GEOMETRY object.

Determines if one GEOMETRY object spatially crosses another GEOMETRY object. If two objects touch only at a border, ST_Crosses returns FALSE.

Two objects spatially cross when both of the following are true:

  • The two objects have some, but not all, interior points in common.

  • The dimension of the result of their intersection is less than the maximum dimension of the two objects.

Behavior type

Immutable

Syntax

ST_Crosses( g1, g2 )

Arguments

g1
Spatial object, type GEOMETRY
g2
Spatial object, type GEOMETRY

Returns

BOOLEAN

Supported data types

Data Type GEOMETRY
Point Yes
Multipoint Yes
Linestring Yes
Multilinestring Yes
Polygon Yes
Multipolygon Yes
GeometryCollection Yes

Examples

The following examples show how to use ST_Crosses.

=> SELECT ST_Crosses(ST_GeomFromText('LINESTRING(-1 3,1 4)'),
   ST_GeomFromText('LINESTRING(-1 4,1 3)'));
 ST_Crosses
------------
 t
(1 row)

=> SELECT ST_Crosses(ST_GeomFromText('LINESTRING(-1 1,1 2)'),
   ST_GeomFromText('POLYGON((1 1,0 -1,3 -1,2 1,1 1))'));
 ST_Crosses
------------
 f
(1 row)

=> SELECT ST_Crosses(ST_GeomFromText('POINT(-1 4)'),
   ST_GeomFromText('LINESTRING(-1 4,1 3)'));
ST_ Crosses
------------
 f
(1 row)