diff --git a/spec/14-extensions.md b/spec/14-extensions.md index 19824e2..f7807d6 100644 --- a/spec/14-extensions.md +++ b/spec/14-extensions.md @@ -107,6 +107,30 @@ global_geo_validate(args): - If the length of {args} is not 1: - Report an error. +### geo::latLng() + +Takes latitude and longitude as arguments and returns a Geo Point. + +geo_latLng(args, scope): + +- Let {latNode} be the first element of {args}. +- Let {lngNode} be the second element of {args}. +- Let {lat} be the result of {Evaluate(latNode, scope)}. +- Let {lng} be the result of {Evaluate(lngNode, scope)}. +- If {lat} or {lng} is not a number: + - Return {null}. +- If {lat} is not in the range of -90 to 90: + - Return {null}. +- If {lng} is not in the range of -180 to 180: + - Return {null}. +- Otherwise: + - Return a GeoJSON Point with {lat} and {lng} as coordinates, in lng, lat order. + +geo_latLng_validate(args): + +- If the length of {args} is not 2: + - Report an error. + ### geo::contains() Returns true if first geo argument completely contains the second one, using a planar (non-spherical) coordinate system. Both geo argument can be any geo value. A geo value is considered contained if all its points are within the boundaries of the first geo value. For `MultiPolygon`, it's sufficient that only one of the polygons contains the first geo value. diff --git a/spec/GROQ.md b/spec/GROQ.md index 3f4ee28..57c89d2 100644 --- a/spec/GROQ.md +++ b/spec/GROQ.md @@ -5,7 +5,7 @@ _Current Working Draft_ This is the specification for GROQ (**G**raph-**R**elational **O**bject **Q**ueries), a query language and execution engine made at Sanity, Inc, for filtering and projecting JSON documents. The work started in 2015. The development of this open standard started in 2019. GROQ is authored by [Alexander Staubo](https://twitter.com/purefiction) and [Simen Svale Skogsrud](https://twitter.com/svale). -Additional follow up work by [Erik Grinaker](https://twitter.com/erikgrinaker), [Magnus Holm](https://twitter.com/judofyr), [Radhe](https://github.com/j33ty), [Israel Roldan](https://github.com/israelroldan), [Sindre Gulseth](https://github.com/sgulseth), [Matt Craig](https://github.com/codebymatt). +Additional follow up work by [Erik Grinaker](https://twitter.com/erikgrinaker), [Magnus Holm](https://twitter.com/judofyr), [Radhe](https://github.com/j33ty), [Israel Roldan](https://github.com/israelroldan), [Sindre Gulseth](https://github.com/sgulseth), [Matt Craig](https://github.com/codebymatt), [Espen Hovlandsdal](https://github.com/rexxars). This specification should be considered _work in progress_ until the first release.