Spatial Find Nearest
Description
Section titled “Description”The Find Nearest step pairs each row of a target table with the rows of a
universe table that are geographically closest to it. For every target row it
keeps the N nearest universe rows — measured as the distance between a geometry
column on each side — and adds a computed Distance column.
It is the SQL-native equivalent of the Alteryx Find Nearest tool: the work runs entirely in the database as a distance-ranked cross join, so it scales to large tables without pulling rows into the workflow engine.
Both geometry columns hold geometries in WKT (well-known text) form, the same representation the other PlaidCloud spatial helpers produce and consume.
N closest universe rows — measured geometry-to-geometry — and appends the computed Distance.Sources and Options
Section titled “Sources and Options”- Target Table — the rows you want neighbours for. Every qualifying target row appears in the output (paired with its nearest universe rows).
- Universe Table — the candidate neighbours that are searched.
- Output Table — the table the results are written to.
- Target geometry / Universe geometry — the WKT geometry column on each side that distance is measured between.
- Nearest count (N) — how many nearest universe rows to keep per target row (default 1).
- Max distance — optional. When set, universe rows farther than this from the target are excluded before ranking. Leave blank (or 0) for no limit.
- Distance units — the unit the
Distanceoutput and Max distance are expressed in: miles, kilometers, meters, or feet. - Ignore zero-distance matches — skip universe rows that sit exactly on the target (distance 0), e.g. to avoid matching a point to itself when the target and universe are the same dataset.
Target and Universe Mapping
Section titled “Target and Universe Mapping”Each input has its own mapping tab that lists the columns available from that table, used both to drive the geometry pickers above and to make columns available to the output.
Output Columns
Section titled “Output Columns”Choose which columns to carry into the output and from which side (target or universe) each comes, renaming them as needed. The computed Distance column (the planar distance to the matched universe row, in the selected units) is added automatically; you can rename it or turn it off.
Stale Columns
Section titled “Stale Columns”An Output Columns row can name a column that its side’s mapping tab, Target Mapping or Universe Mapping, no longer lists. The step never removes such a row for you. Instead, the column name is shown in red behind a ⚠ warning sign, and hovering over it tells you which mapping is missing the column. Nothing is checked against a mapping that lists no columns.
When you save a step that still has flagged rows, a Stale Columns Found dialog lists them and offers three choices:
- Remove All and Save — remove the flagged rows, then save.
- Save Anyway — save the step as it is.
- Cancel — go back to the step without saving.
To keep a row and clear its warning, add the column back on its mapping tab, or pick a column the mapping lists.
Distances are planar (computed on the geometries’ coordinates and scaled to the requested unit), consistent with the other PlaidCloud spatial steps. For lon/lat data this is an approximation that is accurate over the local distances typical of nearest-neighbour analysis (store catchments, service areas, and the like).