     -- (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

    nesw := get_nesw(boundary);
    RAISE NOTICE '%', nesw;

    lrc := (
        SELECT
        -- array_agg(a.l)
        ARRAY_AGG(3)
        FROM unnest(nesw) a(l), unnest(boundary) b(w)
        -- JOIN unnest(ARRAY[rc2[1],rc2[2]]) c(w) ON c.w = b.w
    );
    RAISE NOTICE '%', lrc;

    -- TODO: call get_nesw to get labels for boundary points
    -- distinguish between multiple cases. these cases come up
    -- due to position of the nearby-road relative to the boundary points.
    -- the goal is to decide which corner we're going to cut: NW,NE,SE or SW.

    -- TODO: need to take the decision here on which
    -- direction to sweep in
