-
Postgres (via PostGIS) and BigQuery have a number of built in functions around geometry. Most starting with It's unclear if/how I can use these functions in PRQL. I likely need to define them as functions with s-strings, but again, I'm not sure exactly what that would look like. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
For a one-off, it's easy to use an s-string for this: from foo
select [my_lon, my_lat] # assuming these columns exist
derive point = s"ST_GEOGPOINT({my_lon}, {my_lat})" It's also possible to make a function (but at the moment it needs to be in every file, we don't have importing yet) func geogpoint lon lat -> s"ST_GEOGPOINT({lon}, {lat})"
from foo
derive point = (geogpoint my_lon my_lat) Both of these generate SELECT
my_lon,
my_lat,
ST_GEOGPOINT(my_lon, my_lat) AS point
FROM
foo For adding these to a standard library — very open to that, though maybe we want a separate namespace for them. Someone would have to think about which functions to add initially and how those would correspond to various dialects' current implementations. |
Beta Was this translation helpful? Give feedback.
For a one-off, it's easy to use an s-string for this:
It's also possible to make a function (but at the moment it needs to be in every file, we don't have importing yet)
Both of these generate
For adding these to a standard library — very open to that, though maybe we want a separate namespace for them. Someone would have to think about which functions to add initially and how those would cor…