The x and y coordinates of the passenger locations are in columns x and y, respectively.
Input
- source: source_passenger1, which groups parsed location file formats and contains four passengers with known x and y coordinates
- reference: reference_terminal, as in PointInPolygon Example 1: 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 source PARTITION BY ANY ON reference_terminal AS reference 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 |
---|---|---|
30 | 10 | POLYGON ((0 0, 100 0, 100 100, 0 100, 0 0)) |
300 | 10 | POLYGON ((200 0, 400 0, 400 200, 200 200, 200 0)) |
300 | 20 | POLYGON ((200 0, 400 0, 400 200, 200 200, 200 0)) |
ref_terminal_name | pip_flag | customer_id | customer_name |
---|---|---|---|
Terminal A | 1 | 1 | Jeff |
Terminal B | 1 | 2 | John |
Terminal B | 1 | 3 | Maria |