Skip to content

Commit

Permalink
feat: add geometric data types and functions (#543)
Browse files Browse the repository at this point in the history
PR to add new geometric data types and functions.
  • Loading branch information
richtia authored Sep 28, 2023
1 parent c28f056 commit db52bbd
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 3 deletions.
35 changes: 35 additions & 0 deletions extensions/functions_geometry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
%YAML 1.2
---
types:
- name: geometry
structure: "BINARY"
# description: |
# An opaque type that can represent one or many points, lines, or shapes encompassing
# 2, 3 or 4 dimension.
scalar_functions:
-
name: "point"
description: >
Returns a 2D point with the given `x` and `y` coordinate values.
impls:
- args:
- name: x
value: fp64
- name: y
value: fp64
return: u!geometry
-
name: "makeline"
description: >
Returns a linestring connecting the endpoint of geometry `x` to the begin point of
geometry `y`. 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: u!geometry
- name: y
value: u!geometry
return: u!geometry
13 changes: 10 additions & 3 deletions site/docs/extensions/generate_function_docs.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
#!/usr/bin/python3
# SPDX-License-Identifier: Apache-2.0

import filecmp
import os
import mkdocs_gen_files
import tempfile
from itertools import cycle
from pathlib import Path
import tempfile
import filecmp

import mkdocs_gen_files
import oyaml as yaml
from mdutils.mdutils import MdUtils


def write_markdown(file_obj: dict, file_name: str) -> None:
if "types" in file_obj:
custom_types = file_obj.pop("types")
mdFile.new_header(level=2, title="Data Types")
for type in custom_types:
for key, value in type.items():
mdFile.new_line(f"{key}: {value}")

for function_classification, value in file_obj.items():
function_classification_str = function_classification.replace("_", " ").title()
mdFile.new_header(level=2, title=f"{function_classification_str}")
Expand Down

0 comments on commit db52bbd

Please sign in to comment.