The following examples run against this graph:

Computes the straight-line distance between two points.
| Syntax | distance(<point1>, <point2>) | ||
| Arguments | Name | Type | Description |
<point1> | POINT or POINT3D | The first point | |
<point2> | POINT or POINT3D | The second point | |
| Return Type | DOUBLE | ||
GQLMATCH (n1:City {name: 'New York'}) MATCH (n2:City {name: 'London'}) RETURN distance(n1.location, n2.location)
Result:
| distance(n1.location, n2.location) |
|---|
| 5571177.78487926 |
Constructs a two-dimensional geographical coordinate. The point() function can be used to specify the value of a point-type property.
| Syntax | point({latitude: <lati>, longitude: <longti>}) | ||
| Arguments | Name | Type | Description |
<lati> | Numeric | The latitude value | |
<longti> | Numeric | The longitude value | |
| Return Type | POINT | ||
GQLRETURN point({latitude:39.9, longitude:116.3}) AS point
Result:
| point |
|---|
| POINT(39.9 116.3) |
GQLINSERT (n:City {name: "Tokyo", location: point({latitude: 35.7, longitude: 139.7})}) RETURN n.location
Result:
| n.location |
|---|
| POINT(35.7 139.7) |
Constructs a three-dimensional Cartesian coordinate. The point3d() function can be used to specify the value of a point3d-type property.
| Syntax | point3d({x: <value_x>, y: <value_y>, z: <value_z>}) | ||
| Arguments | Name | Type | Description |
<value_x> | Numeric | The x value | |
<value_y> | Numeric | The y value | |
<value_z> | Numeric | The z value | |
| Return Type | POINT3D | ||
GQLRETURN point3d({x:10, y:15, z:5}) AS point3d
Result:
| point3d |
|---|
| POINT3D(10 15 5) |
GQLINSERT (n:City {name: "Tokyo", landmark: point3d({x:10, y:15, z:5})}) RETURN n.landmark
Result:
| n.landmark |
|---|
| POINT3D(10 15 5) |
Extracts the coordinate values in the point or point3d property.
| Syntax | point3get(<propRef>, <coordName>) | ||
| Arguments | Name | Type | Description |
<propRef> | / | Reference to a point or point3d type property | |
<coordName> | Textual | Coordinate name; the point type is latitude or longitude, the point3d type is x, y or z | |
| Return Type | DOUBLE | ||
GQLMATCH (n {name: "New York"}) RETURN pointget(n.location, "latitude") AS latitude, pointget(n.landmark, "y") AS y
Result:
| latitude | y |
|---|---|
| 40.7 | 23 |