Skip to content

Commit

Permalink
feat: add geometric data types and functions
Browse files Browse the repository at this point in the history
  • Loading branch information
richtia committed Sep 12, 2023
1 parent e4de96b commit e750368
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
32 changes: 32 additions & 0 deletions extensions/extension_types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,35 @@ types:
structure:
start: point
end: point
- name: coordinate
structure:
x: fp64
y: fp64
- name: crs_point
structure:
x: fp64
y: fp64
crs: string
- name: linestring
structure:
T: List<coordinate>
- name: polygon
structure:
T: List<List<coordinate>>
- name: multipoint
structure:
T: List<coordinate>
- name: multilinestring
structure:
T: List<linestring>
- name: multipolygon
structure:
T: List<polygon>
- name: any_simple_geometry
parameters:
- name: T
type: union<crs_point, linestring, polygon, multipoint, multilinestring, multipolygon>
- name: geometry
parameters:
- name: T
type: List<any_simple_geometry>
29 changes: 29 additions & 0 deletions extensions/functions_geometry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
%YAML 1.2
---
scalar_functions:
-
name: "point"
description: >
Return a 2D point with the given `x` and `y` coordinate values.
impls:
- args:
- name: x
value: fp64
- name: y
value: fp64
return: geometry
-
name: "makeline"
description: >
Return a linestring containing the points of the two input geometries.
Repeated points at the beginning of input geometries are collapsed to a single point.
A linestring can be closed or simple. A closed linestring starts and ends on the same
point. A simple linestring does not cross or touch itself.
impls:
- args:
- name: x
value: geometry
- name: y
value: geometry
return: geometry

0 comments on commit e750368

Please sign in to comment.