The x and y coordinates of the passenger locations are in columns x and y, respectively.
Input
- SourceTable: source_passenger1, which groups parsed location file formats and contains four passengers with known x and y coordinates
- ReferenceTable: reference_terminal, as in PointInPolygon Example: OutputAll ('true')
customer_id | x | y | customer_name |
---|---|---|---|
1 | 30 | 10 | Jeff |
1 | 300 | 10 | John |
1 | 300 | 20 | Maria |
1 | 400 | 20 | Macy |
SQL Call
SELECT * FROM PointInPolygon ( ON source_passenger1 AS SourceTable PARTITION BY ANY ON reference_terminal AS ReferenceTable dimension USING SourceLocationColumn ('x','y') ReferenceLocationColumn ('reference_location_polygon') ReferenceNameColumns ('terminal_name') outputall ('false') Accumulate ('customer_id', 'customer_name') ) AS dt ORDER BY x,y ;
Output
x y ref_reference_location_polygon ref_terminal_name pip_flag customer_id customer_name --- -- ------------------------------------------------- ----------------- -------- ----------- ------------- 30 10 polygon ((0 0, 100 0, 100 100, 0 100, 0 0)) terminal a 1 1 jeff 300 10 polygon ((200 0, 400 0, 400 200, 200 200, 200 0)) terminal b 1 2 john 300 20 polygon ((200 0, 400 0, 400 200, 200 200, 200 0)) terminal b 1 3 maria
Download a zip file of all examples and a SQL script file that creates their input tables.