Adding defaults to the OBS_GETDEMOGRAPHICSNAPSHOT

This commit is contained in:
Stuart Lynn 2016-04-13 11:12:29 -04:00
parent 0f588452e0
commit 346f381a9c

View File

@ -23,7 +23,7 @@
-- Creates a table of demographic snapshot -- Creates a table of demographic snapshot
-- TODO: Remove since it does address geocoding? -- TODO: Remove since it does address geocoding?
CREATE OR REPLACE FUNCTION OBS_GetDemographicSnapshot(geom geometry) CREATE OR REPLACE FUNCTION OBS_GetDemographicSnapshot(geom geometry, time_span text default '2009 - 2013', geometry_level text default '"us.census.tiger".block_group' )
RETURNS TABLE( RETURNS TABLE(
total_pop NUMERIC, total_pop NUMERIC,
male_pop NUMERIC, male_pop NUMERIC,
@ -210,7 +210,7 @@ DECLARE
SELECT SELECT
dimension As names, dimension As names,
dimension_value As vals dimension_value As vals
FROM OBS_GetCensus($1,$2) FROM OBS_GetCensus($1,$2,$3,$4)
)' || )' ||
OBS_BuildSnapshotQuery(target_cols) || OBS_BuildSnapshotQuery(target_cols) ||
' FROM a'; ' FROM a';
@ -218,7 +218,7 @@ DECLARE
RETURN QUERY RETURN QUERY
EXECUTE EXECUTE
q q
USING geom, target_cols; USING geom, target_cols, time_span, geometry_level;
RETURN; RETURN;
END; END;