 # Spatial Match Behavior

The behavior of the Spatial Match tool depends on the intersection method selected (Intersects, Contains or Within) and the types of the objects being tested.  The tables below list the various combinations.

## Intersects

A Spatial Object... intersects a... if... The type of the returned intersection object (if requested) is...

Polygon

Polygon

the polygons share any area. Touching edges without overlap is not considered an intersect.

Polygon

Polygon

Line

the line touches the edge or interior of the polygon

Polyline

Polygon

Point

the polygon contains the point

Point

Line

Line

any part of the lines cross each other or share endpoints

Point

Lines may intersect at multiple points, in which case 1 point is returned and a warning is issued.

Line

Point

the point is a vertex of the line.

Note: A line may cross over a point geometrically without a vertex there, and this is not counted as an intersection.

Point

MultiPoint

any object

if it intersects any of the points

MultiPoint

Point

Point

the points are the same

Point

## Contains & Within

A TARGET...

Contains a UNIVERSE...

if...

Polygon

Polygon

99.99% of the second polygons area lies inside the first polygon.

Polygon

Line

99.99% of the length of the line lies inside the polygon.

Polygon

Point

the point is inside the polygon

Polygon

MultiPoint

all the points are in the polygon.

Line

Polygon

Never.

Line

Line

Every segment (i.e. 2-point series) in the contained line also appears in the containing line. Segments consisting of the same 2 points in the opposite order (i.e. coded in the opposite direction) will still match. Lines that follow the same route geometrically may still not match if one uses more (unnecessary) points.

Line

Point

the point is a vertex of the line.

A line may cross over a point geometrically without a vertex, and the line will not be counted as containing the point.

Line

MultiPoint

all the points are vertexes of the line.

MultiPoint

MultiPoint

all the universe points are in the target.

MultiPoint

Point

one of the points are in the MultiPoint.

MultiPoint

Polygon or Line

Never.

Point

Polygon

Never.

Point

Line

Never.

Point Point The points are the same.

Spatial index

If specifying a Calgary (cydb) file, be aware that the Calgary spatial index uses 5 decimal places of accuracy for compression and speed.  The YXDB spatial index uses 6 decimal places.  This adds an addition round off error of up to a maximum of 1.8 feet to Calgary indexes.  In other words, it is possible that a point can be 1.8 feet inside of a polygon and be found as outside in Calgary.