Document toolboxDocument toolbox

Coordinates distance (distance)

Description

Adds a new column that returns the distance in meters between two geocoords.

Learn more about geocoords and their types in the Geocoord (geocoord) article.

How does it work in the search window?

Select Create column in the search window toolbar, then select the Coordinates distance operation. You need to specify two arguments:

Argument

Data type

Argument

Data type

Geocoord mandatory

geocoord

Geocoord mandatory

geocoord

The data type of the new column values is float.

When you apply this operation in the search window interface, Devo automatically transforms the values you enter manually in the Geocoord arguments into geocoord data type.

If you choose a column, it must be a geocoord data type column. You can transform the strings in a field to geocoords creating a new column using the Geocoord (geocoord) or Latitude and longitude coordinates (latlon) operations. 

Example

In the demo.ecommerce.data table, we want to create a column showing the distance between to specific coordinates. To do it, we will create a new column using the Coordinates distance operation.

The arguments needed to create the new column are:

  • Geocoord - Click the pencil icon and enter 40°24'46.3"N 3°41'43"W

  • Geocoord - Click the pencil icon and enter 56°24'46.3"N 3°41'43.8"W

Click Create column and you will see the following result:

How does it work in LINQ?

Use the operator select... as...  and add the operation syntax to create the new column. These are the valid formats of the Coordinates distance operation:

  • distance(geocoord1, geocoord2)

  • distance(geocoord(string1), geocoord(string2))

  • distance(latlon(string1), latlon(string2))

As seen in the above syntaxes, you must transform the strings added as arguments to data type geocoord using the Geocoord (geocoord) or Latitude and longitude coordinates (latlon) operations.

Example

You can copy the following LINQ script and try the above example on the demo.ecommerce.data table.

from demo.ecommerce.data select distance(geocoord("40°24'46.30000000000564\"N 3°41'43.80000000000152\"W"), geocoord("56°24'46.30000000000564\"N 3°41'43.80000000000152\"W")) as coord_distance