Skip to content

Commit

Permalink
feat: add geo::latLng() (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars authored Sep 25, 2024
1 parent 37df252 commit f8f928a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
24 changes: 24 additions & 0 deletions spec/14-extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion spec/GROQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit f8f928a

Please sign in to comment.