Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » SQL Anywhere Server - Spatial Data Support » Spatial types and functions » ST_Geometry type

ST_Crosses method

Tests if a geometry value crosses another geometry value.

Name Type Description



The other geometry value that is to be compared to the geometry-expression.

  • BIT

    Returns 1 if the geometry-expression crosses geo2, otherwise 0. Returns NULL if geometry-expression is a surface or multisurface, or if geo2 is a point or multipoint.


Tests if a geometry value crosses another geometry value.

When both geometry-expression and geo2 are curves or multicurves, they cross each other if their interiors intersect at one or more points. If the intersection results in a curve or multicurve, the geometries do not cross. If all of the intersecting points are boundary points, the geometries do not cross.

When geometry-expression has lower dimension than geo2, then geometry-expression crosses geo2 if part of geometry-expression is on the interior of geo2 and part of geometry-expression is on the exterior of geo2.

More precisely, geometry-expression.ST_Crosses( geo2 ) returns 1 when the following is TRUE:

( geometry-expression.ST_Dimension() = 1 AND geo2.ST_Dimension() = 1 AND geometry-expression.ST_Relate( geo2, '0********' ) = 1 ) OR( geometry-expression.ST_Dimension() < geo2.ST_Dimension() AND geometry-expression.ST_Relate( geo2, 'T*T******' ) = 1 )
Note If the geometry-expression contains circularstrings, then these are interpolated to line strings.
Note This method cannot be used with geometries in round-Earth spatial reference systems.
  • SQL/MM (ISO/IEC 13249-3: 2006)



The following example returns the result 1.

SELECT NEW ST_LineString( 'LineString( 0 0, 2 2 )' )
        .ST_Crosses( NEW ST_LineString( 'LineString( 0 2, 2 0 )' ) )

The following examples returns the result 0 because the interiors of the two lines do not intersect (the only intersection is at the first linestring boundary).

SELECT NEW ST_LineString( 'LineString( 0 1, 2 1 )' )
        .ST_Crosses( NEW ST_LineString( 'LineString( 0 0, 2 0 )' ) )

The following example returns NULL because the first geometry is a surface.

SELECT NEW ST_Polygon( 'Polygon(( 0 0, 0 1, 1 0, 0 0))' )
        .ST_Crosses( NEW ST_LineString( 'LineString( 0 0, 2 0 )' ) )