Merge pull request #47710 from den-crane/patch-57

Doc. fix greatCircleDistance example
This commit is contained in:
robot-ch-test-poll 2023-03-19 00:51:35 +01:00 committed by GitHub
commit 217d683da4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,13 +31,13 @@ Generates an exception when the input parameter values fall outside of the range
**Example**
``` sql
SELECT greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673)
SELECT greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673) AS greatCircleDistance
```
``` text
┌─greatCircleDistance(55.755831, 37.617673, -55.755831, -37.617673)─┐
14132374.194975413
└───────────────────────────────────────────────────────────────────
┌─greatCircleDistance─┐
14128352
└─────────────────────┘
```
## geoDistance
@ -47,6 +47,37 @@ The performance is the same as for `greatCircleDistance` (no performance drawbac
Technical note: for close enough points we calculate the distance using planar approximation with the metric on the tangent plane at the midpoint of the coordinates.
``` sql
geoDistance(lon1Deg, lat1Deg, lon2Deg, lat2Deg)
```
**Input parameters**
- `lon1Deg` — Longitude of the first point in degrees. Range: `[-180°, 180°]`.
- `lat1Deg` — Latitude of the first point in degrees. Range: `[-90°, 90°]`.
- `lon2Deg` — Longitude of the second point in degrees. Range: `[-180°, 180°]`.
- `lat2Deg` — Latitude of the second point in degrees. Range: `[-90°, 90°]`.
Positive values correspond to North latitude and East longitude, and negative values correspond to South latitude and West longitude.
**Returned value**
The distance between two points on the Earths surface, in meters.
Generates an exception when the input parameter values fall outside of the range.
**Example**
``` sql
SELECT geoDistance(38.8976, -77.0366, 39.9496, -75.1503) AS geoDistance
```
``` text
┌─geoDistance─┐
│ 212458.73 │
└─────────────┘
```
## greatCircleAngle
Calculates the central angle between two points on the Earths surface using [the great-circle formula](https://en.wikipedia.org/wiki/Great-circle_distance).