     RETURN retval;
 END;
 $$ LANGUAGE plpgsql;
-\set QUIET 0
-
-
-
-
-\set QUIET 1
+
+
+-- TODO: implement and use this function in pseudo_parcel
+-- label boundary points with indicators based on which edge of the bounding
+-- box they're on
+CREATE OR REPLACE FUNCTION get_nesw(ps geometry[]) RETURNS void AS $$
+DECLARE
+BEGIN
+    -- the way we're going to label points is as follows
+    -- we're going to check whether they have YMax or YMin
+    -- and add an 'N' or 'S' and then we're going to check if they have
+    -- an XMin or XMax and add an 'W' or 'E'
+END;
+$$ LANGUAGE plpgsql;
+
 -- this function will implement the corner-cut algorithm
-DROP FUNCTION pseudo_parcel(integer, integer);
 CREATE OR REPLACE FUNCTION pseudo_parcel(p_uid integer, area integer) RETURNS void AS $$
 DECLARE
 bbox    geometry;

    );
    INSERT INTO support(way) VALUES (bbox);

    -- in NESW we have all the extreme points on the boundary
    -- sorted by azimuth, so nesw[1] is north, nesw[2] is east
    -- nesw[3] is south, nesw[4] is west.

        ), center AS (
            -- get centroid of polygon defined by N,E,S,W extreme points
            SELECT
            ST_Centroid(ST_ExteriorRing(ST_Envelope(ST_Collect(p)))) AS c
            FROM unpacked
        ), sorted_cw AS (
            -- sort extreme points clock-wise
            SELECT
            a.p AS way
            FROM unpacked a, center b
            ORDER BY ST_Azimuth(b.c, a.p)
        )
        SELECT array_agg(way)
        FROM sorted_cw
