This gem runs in .
Overview
Use the Distance gem to calculate the distance between two geographic points.Prerequisites
- Add
ProphecyDatabricksSqlSpatialversion 0.0.1 or higher to your project.
Parameters
Configure the Distance gem using the following parameters.Geographic points must be in Well-known Text
(WKT) format. Use the
CreatePoint gem to convert longitude and latitude
coordinates to WKT format.
Spatial Object Fields
Use these parameters to specify the columns containing the source and destination geographic points for distance calculation.Select Output Options
Use the checkboxes defined below to choose which output columns the Distance gem should generate.You can select zero, one, or multiple checkboxes. All checkboxes are disabled by default.
Example
Assume you have the following airline route table, and you would like to calculate the distance between start and destination cities.
To find the distance and direction between cities, set the following gem configurations.
-
Set source and destination:
- Set Source Type to Point.
-
Set Source Column to
start. - Set Destination Type to Point.
-
Set Destination Column to
destination.
-
Set output options:
- Select the Output Distance checkbox.
- From the Units dropdown, select Kilometers.
- Select the Output Cardinal Direction checkbox.
- Select the Output Direction in Degrees checkbox.
- Run the gem.
Result
The resulting table will have three new columns:distance_kilometers, cardinal_direction, and direction_degrees.
Scroll horizontally to view the full table.

