Outdated Version

You are viewing an older version of this section. View current production version.

GEOGRAPHY_DISTANCE

This function takes in two geospatial objects and measures the shortest distance between them, in meters.

image

Syntax

GEOGRAPHY_DISTANCE ( geo1, geo2 )

Arguments

  • geo1, geo2: any valid geospatial object or WKT string: path, point or polygon.

Return Type

A double. The measured distance, in meters.

Examples

memsql> select b.name as neighbor,
    -> round(GEOGRAPHY_DISTANCE(a.shape, b.shape), 0) as distance_from_border
    -> from neighborhoods a, neighborhoods b
    -> where a.id = 2
    -> order by 1;
+---------------------+----------------------+
| neighbor            | distance_from_border |
+---------------------+----------------------+
| Probability Bay     |                    0 |
| Lower Bound Valley  |                    0 |
| Axiom Township      |                    0 |
| Elegant Island      |                 1935 |
| Upper Bound Hill    |                 5632 |
| Big Endian          |                 9016 |
| Little Endian       |                17290 |
| Isle Zero           |                17163 |
...