diff --git a/src/pg/sql/50_contours.sql b/src/pg/sql/50_contours.sql index 067c91b..545f518 100644 --- a/src/pg/sql/50_contours.sql +++ b/src/pg/sql/50_contours.sql @@ -1,17 +1,3 @@ -CREATE OR REPLACE FUNCTION - CDB_Contours ( - subquery TEXT, - grid_size NUMERIC DEFAULT 100, - bandwidth NUMERIC DEFAULT 0.0001, - levels NUMERIC[] DEFAULT null - ) -RETURNS table (level Numeric, geom text ) -AS $$ - RETURN QUERY - select level, ST_GeomFromText(geom_text, 4326) as geom from _CDB_Contours(subquery,grid_size,bandwidth,levels); - RETURN; -$$ LANGUAGE plpgsql; - CREATE OR REPLACE FUNCTION _CDB_Contours ( @@ -26,3 +12,19 @@ AS $$ # TODO: use named parameters or a dictionary return cdb_generate_contours(subquery, grid_size, bandwidth, levels) $$ LANGUAGE plpythonu; + + +CREATE OR REPLACE FUNCTION + CDB_Contours ( + subquery TEXT, + grid_size NUMERIC DEFAULT 100, + bandwidth NUMERIC DEFAULT 0.0001, + levels NUMERIC[] DEFAULT null + ) +RETURNS table (level Numeric, geom text ) +AS $$ +BEGIN + RETURN QUERY + select l as level, ST_GeomFromText(geom_text, 4326) as geom from _CDB_Contours(subquery,grid_size,bandwidth,levels); +END; +$$ LANGUAGE plpgsql; diff --git a/src/py/crankshaft/crankshaft/__init__.py b/src/py/crankshaft/crankshaft/__init__.py index d07e330..ac0e870 100644 --- a/src/py/crankshaft/crankshaft/__init__.py +++ b/src/py/crankshaft/crankshaft/__init__.py @@ -1,2 +1,3 @@ import random_seeds import clustering +import contours