CreatePoint
Use the CreatePoint gem to convert longitude and latitude coordinates into geographic points.
Parameters
Each longitude and latitude column pair produces one target column. You can provide more than one longitude and latitude pairing to produce multiple target columns if necessary.
Parameter | Description |
---|---|
Longitude Column Name | Input column that contains longitude values. |
Latitude Column Name | Input column that contains latitude values. |
Target Column Name | Column in the gem output that will contain resulting geo points. |
The target column(s) will contain points in Well-known text (WKT) geometric format.
Example
Assume you have the following airline route table.
start_city | start_lat | start_long | destination_city | destination_lat | destination_long |
---|---|---|---|---|---|
New York | 40.7128 | -74.0060 | Los Angeles | 34.0522 | -118.2437 |
London | 51.5074 | -0.1278 | Paris | 48.8566 | 2.3522 |
Tokyo | 35.6895 | 139.6917 | Sydney | -33.8688 | 151.2093 |
Toronto | 43.6511 | -79.3470 | Chicago | 41.8781 | -87.6298 |
Dubai | 25.2760 | 55.2962 | Mumbai | 19.0760 | 72.8777 |
To convert the start and destination coordinates into geographic points:
-
Create the first column pairing:
-
Click Add a Point.
-
For Longitude Column Name, select the
start_long
column. -
For Latitude Column Name, select the
start_lat
column. -
For the Target Column Name, type
source_point
.
-
-
Create another column pairing:
-
Click Add a Point.
-
For Longitude Column Name, select the
destination_long
column. -
For Latitude Column Name, select the
destination_lat
column. -
For the Target Column Name, type
dest_point
.
-
Result
The CreatePoint gem will produce the following output with two new columns: source_point
and dest_point
.
start_city | start_lat | start_long | destination_city | destination_lat | destination_long | source_point | dest_point |
---|---|---|---|---|---|---|---|
New York | 40.7128 | -74.0060 | Los Angeles | 34.0522 | -118.2437 | POINT (-74.0060 40.7128) | POINT (-118.2437 34.0522) |
London | 51.5074 | -0.1278 | Paris | 48.8566 | 2.3522 | POINT (-0.1278 51.5074) | POINT (2.3522 48.8566) |
Tokyo | 35.6895 | 139.6917 | Sydney | -33.8688 | 151.2093 | POINT (139.6917 35.6895) | POINT (151.2093 -33.8688) |
Toronto | 43.6511 | -79.3470 | Chicago | 41.8781 | -87.6298 | POINT (-79.3470 43.6511) | POINT (-87.6298 41.8781) |
Dubai | 25.2760 | 55.2962 | Mumbai | 19.0760 | 72.8777 | POINT (55.2962 25.2760) | POINT (72.8777 19.0760) |