GeometryOverlay Example 2: Union - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
8.00
1.0
Published
May 2019
Language
English (United States)
Last Update
2019-11-22
dita:mapPath
blj1506016597986.ditamap
dita:ditavalPath
blj1506016597986.ditaval
dita:id
B700-4003
lifecycle
previous
Product Category
Teradata Vantageā„¢

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

Input

Input tables are from GeometryOverlay Example 1: Intersection:

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

SQL Call

SELECT * FROM GeometryOverlay (
  ON source_gatetype AS source PARTITION BY id
  ON ref_terminal AS reference PARTITION BY id
  USING
  SourceLocationColumn ('boundary_coordinates')
  ReferenceLocationColumn ('boundary_coordinates')
  ReferenceNameColumns ('boundary_name')
  BoundaryOperator ('union')
  OutputAll ('false')
  Accumulate ('boundary_name', 'id')
) AS dt ORDER BY 2, 1;

Output

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 US 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