     -- (so they will be clock-wise sorted)
     boundary := (
         WITH int AS (
+            --
             -- intersect the polygon ring with the
             -- envelope(bounding-box) ring to get the boundary
             -- extremum points (north,east,south,west).

                WHERE gid = p_uid
            ) a
        ), unpacked AS (
            -- unpack ST_MultiPoint to ST_Point
            SELECT (ST_Dump(way)).geom AS p
            FROM int

bbox      geometry;
-- extreme cardinal points on the polygon boundary
boundary  geometry[];
-- labels for boundary points
nesw      text[];
-- two extreme points closest to the nearest road, and the road point
rc2       geometry[];
-- labels for near-road points
lrc       text[];
BEGIN
    bbox := (
        -- get parcel boundary
