Skip to content

Not every geospatial operation needs a dedicated step. Anything that is a single-row column expression runs as a Table Extract expression cell, in the database, with no rows leaving the warehouse — so it scales with the table rather than with the workflow engine. This is the route Alteryx conversion picks for the Alteryx Create Points and Distance tools.

Lakehouse v1 and v2 spell their geometry functions differently — ST_MAKEGEOMPOINT against ST_POINT, ST_ASWKT against ST_ASTEXT. The geom_* family resolves to the right one for the workspace you are running on, so an expression written once works on both.

Expression Lakehouse v1 Lakehouse v2
func.geom_from_wkt(x) ST_GEOMETRYFROMWKT ST_GEOMETRYFROMTEXT
func.geom_point(lon, lat) ST_MAKEGEOMPOINT ST_POINT
func.geom_as_wkt(g) ST_ASWKT ST_ASTEXT
func.geom_contains(a, b) ST_CONTAINS ST_CONTAINS
func.geom_within(a, b) ST_WITHIN ST_CONTAINS, arguments swapped
func.geom_x(g) ST_X ST_X
func.geom_y(g) ST_Y ST_Y

Build a WKT point from a longitude column and a latitude column:

func.geom_as_wkt(
func.geom_point(
get_column(table, 'Longitude'),
get_column(table, 'Latitude'),
)
)

geom_as_wkt writes the result as WKT, the form every PlaidCloud spatial step reads and writes.

Distance is the one operation here with no portable spelling — the two lakehouses disagree on both the function and its return unit, so the expression differs by version.

ST_DISTANCE_SPHERE takes four coordinates and returns meters:

case(
(
and_(
get_column(table, 'Origin').like('POINT%'),
get_column(table, 'Destination').like('POINT%'),
),
func.st_distance_sphere(
func.geom_x(func.geom_from_wkt(get_column(table, 'Origin'))),
func.geom_y(func.geom_from_wkt(get_column(table, 'Origin'))),
func.geom_x(func.geom_from_wkt(get_column(table, 'Destination'))),
func.geom_y(func.geom_from_wkt(get_column(table, 'Destination'))),
) * 0.0006213711922373339,
),
else_=null,
)
Unit Factor from meters
Miles 0.0006213711922373339
Kilometers 0.001
Meters 1
Feet 3.280839895013123

geom_distance is planar over two geometries and returns degrees, so the factor converts from degrees rather than meters:

func.geom_distance(
func.geom_from_wkt(get_column(table, 'Origin')),
func.geom_from_wkt(get_column(table, 'Destination')),
) * 69.1709
Unit Factor from degrees
Miles 69.1709
Kilometers 111.32
Meters 111320.0
Feet 364566.929

Being planar, this is an approximation that degrades away from the equator — fine over the local distances typical of catchment analysis, less so across a continent.

The LIKE 'POINT%' guard on the v2 form matters: ST_DISTANCE_SPHERE takes four coordinates, so a non-point geometry on either side would silently measure the wrong thing. The CASE returns null for those rows instead.

You want Use
Distance from each row to its nearest rows in another table Spatial Find Nearest
Distance as a filter in a spatial join Spatial Match
Area, length, centroid, or bounding box Spatial Info
Anything that changes the shape of a geometry Geospatial steps