-
Notifications
You must be signed in to change notification settings - Fork 1
Overlay Functions
Description: Unions the input geometries, merging geometry to produce a result geometry with no overlaps
Input Argument #1: Geometry (WKB)
Input Argument #2: Geometry (WKB)
Output: The spatial union of the two input geometries (WKB)
SELECT ST_AsText(
ST_Union(
ST_GeomFromText(
'POINT(1 2)'
),
ST_GeomFromText(
'POINT(-2 3)'
)
)
)
Result
MULTIPOINT ((-2 3), (1 2))
Description: Returns a geometry representing the part of geometry #1 that does not intersect with geometry #2
Input Argument #1: Geometry (WKB)
Input Argument #2: Geometry (WKB)
Output: The spatial (non-symmetric) difference between the 2 input geometries (WKB)
SELECT ST_AsText(
ST_Difference(
ST_GeomFromText(
'LINESTRING(50 100, 50 200)'
),
ST_GeomFromText(
'LINESTRING(50 50, 50 150)'
)
)
)
Result
LINESTRING (50 150, 50 200)
Description: Returns a point-set geometry representing the part of geometry #1 that intersects with geometry #2
Input Argument #1: Geometry (WKB)
Input Argument #2: Geometry (WKB)
Output: The spatial intersection between the 2 input geometries (WKB)
SELECT ST_AsText(
ST_Intersection(
ST_GeomFromText(
'POLYGON((1 2,1 5,4 5,4 2,1 2))'
),
ST_GeomFromText(
'POLYGON((3 1,3 3,5 3,5 1,3 1))'
)
)
)
Result
POLYGON ((4 3, 4 2, 3 2, 3 3, 4 3))