Skip to main content

GEO_DISTANCE

Calculates the distance between two points

Updated over 2 weeks ago

Description

The GEO_DISTANCE() function valculates the distance between two latitude/longitude points.

Syntax

GEO_DISTANCE(latitude1, longitude1, latitude2, longitude2, [unit])

Output

number

Variables

  1. latitude1: The latitude of the first point.

  2. longitude1: The longitude of the first point.

  3. latitude2: The latitude of the second point.

  4. longitude2: The longitude of the second point.

  5. unit (optional): The distance metric of the calculation. Values can be either 'km' or 'mi'. Default is 'km'.

Example

GEO_DISTANCE(`Lat1`, `Long1`, `Lat2`, `Long2`)

Lat1

Long1

Lat2

Long2

GEO_DISTANCE

34.0309

-118.263

34.0711

-118.225

5.71207

34.0416

-118.247

34.0711

-118.225

3.851022

34.0936

-118.276

34.0711

-118.225

5.321648

34.0803

-118.242

34.0711

-118.225

1.88576

34.0312

-118.237

34.0711

-118.225

4.576836

Did this answer your question?