Geospatial

DISTANCE

DISTANCE(geopoint1, geopoint2)

Computes geographical distance between two geographical coordinates (expressed in GEOPOINT) in kilometers, using spherical law of cosines formula.

output type:DOUBLE

Example:

1
dual | select(DISTANCE(GEO(200.100.32.45),GEO(37.279452,-121.886943)));
distance
10406.78617597444

BEARING

BEARING(geopoint1, geopoint2)

Computes bearing in degrees from geopoint1 to geopoint2.

output type:DOUBLE

Example:

1
dual | select(BEARING(GEO(200.100.32.45),GEO(37.279452,-121.886943)));
bearing
309.51329218671503

GEO_POINT_IN

GEO_POINT_IN(geopoint, area)

Returns true if geopoint argument is located within given area - specified as an array of sequentially connected GEOPOINTs representing a closed polygon. The last geopoint is assumed to be connected with the first one.

output type:BOOLEAN

Example:

1
2
3
4
5
6
7
8
dual
| select(GEO(59.396654, 24.658450))
| select(GEO_POINT_IN(geo,
    [GEO(59.3968915, 24.6578264),
     GEO(59.3963126, 24.6578264),
     GEO(59.3962798, 24.6590495),
     GEO(59.3968806, 24.6590924)]
     ));
geo_point_in
true

GEO_ROUND

GEO_ROUND(location, edge_len_km)

Returns center point of a square with the specified length of edges in kilometers, containing geopoint location on spherically modeled Earth.

The function can be used for aggregations and joins based on geographical area.

output type:GEOPOINT

Example:

1
dual | select(gp:GEO(59.396654, 24.658450)) | select(GEO_ROUND(gp, 100));
geo_round
59.737045,24.322617

LATITUDE

LATITUDE(geopoint)

Returns latitude coordinate value from GEOPOINT argument.

output type:FLOAT

Example:

1
dual | select(gp:GEO(84.50.125.243)) | select(LATITUDE(gp));
latitude
59.433

LONGITUDE

LONGITUDE(geopoint)

Returns longitude coordinate from GEOPOINT argument.

output type:FLOAT

Example:

1
dual | select(gp:GEO(84.50.125.243)) | select(LONGITUDE(gp));
longitude
24.7323