   EXECUTE format(
     'SELECT ST_PointOnSurface(t.%s) As %s, t.%s
      FROM observatory.%s As t
-     WHERE ST_Contains($1, t.the_geom)
-     ', geom_colname, geom_colname, geoid_colname, target_table)
+     WHERE ST_%s($1, t.the_geom)
+     ', geom_colname, geom_colname, geoid_colname, target_table, overlap_type)
   USING geom;
 
 END;

CREATE OR REPLACE FUNCTION cdb_observatory.OBS_GetBoundariesByBBox(
  geom geometry(Geometry, 4326),
  boundary_id text,
  time_span text DEFAULT NULL)
RETURNS TABLE(boundary geometry, geom_refs text)
AS $$
DECLARE

CREATE OR REPLACE FUNCTION cdb_observatory.OBS_GetPointsByBBox(
  geom geometry(Geometry, 4326),
  boundary_id text,
  time_span text DEFAULT NULL,
  overlap_type text DEFAULT 'contains')
RETURNS TABLE(boundary geometry, geom_refs text)
AS $$
DECLARE
