ST_DIFFERENCE
functionsupportedCore SQL functionsGiven two input GEOGRAPHY objects, returns a GEOGRAPHY object that represents the points in the first object that are not in the second object (i.e. the difference between the two objects).
Syntax
ST_DIFFERENCE( <geography_expression_1> , <geography_expression_2> )
Parameters
| Name | Required | Description |
|---|---|---|
geography_expression_1 | required | A GEOGRAPHY object. |
geography_expression_2 | required | A GEOGRAPHY object. |
Returns
The function returns a value of type GEOGRAPHY. If all points of geography_expression_1 are in geography_expression_2 (i.e. the difference is an empty set of points), the function returns NULL.
Usage notes
- If any vertex of one input object is on the boundary of the other input object (excluding the vertices), the output might not be accurate.
- The function is not guaranteed to produce normalized and/or minimal results. For example, an output could consist of a LineString containing several Points that actually forms just one straight segment.