1.1 - 8.10 - GeometryOverlay Example: Union - Teradata Vantage

Teradata Vantage™ - Machine Learning Engine Analytic Function Reference

Teradata Vantage
Release Number
October 2019
Content Type
Programming Reference
Publication ID
English (United States)

This example computes the union of area for both the gates and the terminals.


Input tables are from GeometryOverlay Example: Intersection:

  • SourceTable: source_gatetype, which contains the geometrical coordinates of US and international gates in three airport terminals (A, B, and C)
  • ReferenceTable: ref_terminal, which contains the terminal coordinates in WKT syntax

SQL Call

SELECT * FROM GeometryOverlay (
  ON source_gatetype AS SourceTable PARTITION BY id
  ON ref_terminal AS ReferenceTable PARTITION BY id
  SourceLocationColumn ('boundary_coordinates')
  ReferenceLocationColumn ('boundary_coordinates')
  ReferenceNameColumns ('boundary_name')
  BoundaryOperator ('union')
  OutputAll ('false')
  Accumulate ('boundary_name','id')
) AS dt ;


Because all US gates are within Terminal A, the union of the area specified by the domestic gates and the area of Terminal A is just Terminal A, as shown in the first row of the output. The second row shows the union of the coordinates of the international gates and all three terminals.

 overlay_boundary                                                                  ref_boundary_name overlay_flag boundary_name        id 
 --------------------------------------------------------------------------------- ----------------- ------------ -------------------- -- 
 POLYGON ((0 0, 0 100, 100 100, 100 0, 0 0))                                       terminal a                   1 domestic gates        1
 POLYGON ((50 50, 50 150, 150 150, 150 100, 200 100, 200 0, 100 0, 100 50, 50 50)) terminal b                   1 international gates   2

Download a zip file of all examples and a SQL script file that creates their input tables from the attachment in the left sidebar.