The following example tests if a point is within a polygon. The point is completely within the polygon, and the interior of
the point (the point itself) intersects the interior of the polygon, so the example returns 1.
The following example tests if a line is within a polygon. The line is completely within the polygon, but the interior of
the line and the interior of the polygon do not intersect (the line only intersects the polygon on the polygon's boundary,
and the boundary is not part of the interior), so the example returns 0. If ST_CoveredBy was used in place of ST_Within, ST_CoveredBy
would return 1.
The following example lists the ShapeIDs where the given point is within the Shape geometry. This example returns the result
3,5. Note that ShapeID 6 is not listed because the point intersects that row's Shape polygon at the polygon's boundary.
SELECT LIST( ShapeID ORDER BY ShapeID )
WHERE NEW ST_Point( 1, 4 ).ST_Within( Shape ) = 1