-- -- PostgreSQL database dump -- SET SESSION AUTHORIZATION 'postgres'; SET search_path = public, pg_catalog; -- -- TOC entry 79 (OID 31733) -- Name: plpgsql_call_handler(); Type: FUNC PROCEDURAL LANGUAGE; Schema: public; Owner: postgres -- CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler AS '$libdir/plpgsql', 'plpgsql_call_handler' LANGUAGE c; SET SESSION AUTHORIZATION DEFAULT; -- -- TOC entry 78 (OID 31734) -- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: public; Owner: -- CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler; SET SESSION AUTHORIZATION 'postgres'; -- -- TOC entry 3 (OID 2200) -- Name: public; Type: ACL; Schema: -; Owner: postgres -- REVOKE ALL ON SCHEMA public FROM PUBLIC; GRANT ALL ON SCHEMA public TO PUBLIC; SET check_function_bodies = false; -- -- TOC entry 80 (OID 31736) -- Name: histogram2d_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION histogram2d_in(cstring) RETURNS histogram2d AS '$libdir/libpostgis.so.0.8', 'histogram2d_in' LANGUAGE c STRICT; -- -- TOC entry 81 (OID 31737) -- Name: histogram2d_out(histogram2d); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION histogram2d_out(histogram2d) RETURNS cstring AS '$libdir/libpostgis.so.0.8', 'histogram2d_out' LANGUAGE c STRICT; -- -- TOC entry 8 (OID 31735) -- Name: histogram2d; Type: TYPE; Schema: public; Owner: postgres -- CREATE TYPE histogram2d ( INTERNALLENGTH = variable, INPUT = histogram2d_in, OUTPUT = histogram2d_out, ALIGNMENT = double, STORAGE = main ); -- -- TOC entry 82 (OID 31740) -- Name: box3d_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION box3d_in(cstring) RETURNS box3d AS '$libdir/libpostgis.so.0.8', 'box3d_in' LANGUAGE c STRICT; -- -- TOC entry 83 (OID 31741) -- Name: box3d_out(box3d); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION box3d_out(box3d) RETURNS cstring AS '$libdir/libpostgis.so.0.8', 'box3d_out' LANGUAGE c STRICT; -- -- TOC entry 4 (OID 31739) -- Name: box3d; Type: TYPE; Schema: public; Owner: postgres -- CREATE TYPE box3d ( INTERNALLENGTH = 48, INPUT = box3d_in, OUTPUT = box3d_out, ALIGNMENT = double, STORAGE = plain ); -- -- TOC entry 84 (OID 31744) -- Name: spheroid_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION spheroid_in(cstring) RETURNS spheroid AS '$libdir/libpostgis.so.0.8', 'ellipsoid_in' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 85 (OID 31745) -- Name: spheroid_out(spheroid); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION spheroid_out(spheroid) RETURNS cstring AS '$libdir/libpostgis.so.0.8', 'ellipsoid_out' LANGUAGE c STRICT; -- -- TOC entry 5 (OID 31743) -- Name: spheroid; Type: TYPE; Schema: public; Owner: postgres -- CREATE TYPE spheroid ( INTERNALLENGTH = 65, INPUT = spheroid_in, OUTPUT = spheroid_out, ALIGNMENT = double, STORAGE = plain ); -- -- TOC entry 86 (OID 31748) -- Name: wkb_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION wkb_in(cstring) RETURNS wkb AS '$libdir/libpostgis.so.0.8', 'WKB_in' LANGUAGE c STRICT; -- -- TOC entry 87 (OID 31749) -- Name: wkb_out(wkb); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION wkb_out(wkb) RETURNS cstring AS '$libdir/libpostgis.so.0.8', 'WKB_out' LANGUAGE c STRICT; -- -- TOC entry 88 (OID 31750) -- Name: wkb_recv(internal); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION wkb_recv(internal) RETURNS wkb AS '$libdir/libpostgis.so.0.8', 'WKB_recv' LANGUAGE c STRICT; -- -- TOC entry 89 (OID 31752) -- Name: chip_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION chip_in(cstring) RETURNS chip AS '$libdir/libpostgis.so.0.8', 'CHIP_in' LANGUAGE c STRICT; -- -- TOC entry 90 (OID 31753) -- Name: chip_out(chip); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION chip_out(chip) RETURNS cstring AS '$libdir/libpostgis.so.0.8', 'CHIP_out' LANGUAGE c STRICT; -- -- TOC entry 6 (OID 31751) -- Name: chip; Type: TYPE; Schema: public; Owner: postgres -- CREATE TYPE chip ( INTERNALLENGTH = variable, INPUT = chip_in, OUTPUT = chip_out, ALIGNMENT = double, STORAGE = extended ); -- -- TOC entry 91 (OID 31756) -- Name: geometry_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometry_in(cstring) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_in' LANGUAGE c STRICT; -- -- TOC entry 92 (OID 31757) -- Name: geometry_out(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometry_out(geometry) RETURNS cstring AS '$libdir/libpostgis.so.0.8', 'geometry_out' LANGUAGE c STRICT; -- -- TOC entry 7 (OID 31755) -- Name: geometry; Type: TYPE; Schema: public; Owner: postgres -- CREATE TYPE geometry ( INTERNALLENGTH = variable, INPUT = geometry_in, OUTPUT = geometry_out, ALIGNMENT = double, STORAGE = main ); -- -- TOC entry 93 (OID 31759) -- Name: postgis_gist_sel(internal, oid, internal, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION postgis_gist_sel(internal, oid, internal, integer) RETURNS double precision AS '$libdir/libpostgis.so.0.8', 'postgis_gist_sel' LANGUAGE c; -- -- TOC entry 16 (OID 31760) -- Name: spatial_ref_sys; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE spatial_ref_sys ( srid integer NOT NULL, auth_name character varying(256), auth_srid integer, srtext character varying(2048), proj4text character varying(2048) ); -- -- TOC entry 17 (OID 31767) -- Name: geometry_columns; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE geometry_columns ( f_table_catalog character varying(256) NOT NULL, f_table_schema character varying(256) NOT NULL, f_table_name character varying(256) NOT NULL, f_geometry_column character varying(256) NOT NULL, coord_dimension integer NOT NULL, srid integer NOT NULL, "type" character varying(30) NOT NULL, attrelid oid, varattnum integer, stats histogram2d ); -- -- TOC entry 94 (OID 31774) -- Name: postgis_version(); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION postgis_version() RETURNS text AS 'SELECT ''0.8 USE_GEOS=1 USE_PROJ=1 USE_STATS=1''::text AS version' LANGUAGE sql; -- -- TOC entry 96 (OID 31775) -- Name: find_srid(character varying, character varying, character varying); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION find_srid(character varying, character varying, character varying) RETURNS integer AS 'DECLARE schem text; tabl text; sr int4; BEGIN IF $1 IS NULL THEN RAISE EXCEPTION ''find_srid() - schema is NULL!''; END IF; IF $2 IS NULL THEN RAISE EXCEPTION ''find_srid() - table name is NULL!''; END IF; IF $3 IS NULL THEN RAISE EXCEPTION ''find_srid() - column name is NULL!''; END IF; schem = $1; tabl = $2; -- if the table contains a . and the schema is empty -- split the table into a schema and a table -- otherwise drop through to default behavior IF ( schem = '''' and tabl LIKE ''%.%'' ) THEN schem = substr(tabl,1,strpos(tabl,''.'')-1); tabl = substr(tabl,length(schem)+2); ELSE schem = schem || ''%''; END IF; select SRID into sr from geometry_columns where f_table_schema like schem and f_table_name = tabl and f_geometry_column = $3; IF NOT FOUND THEN RAISE EXCEPTION ''find_srid() - couldnt find the corresponding SRID - is the geometry registered in the GEOMETRY_COLUMNS table? Is there an uppercase/lowercase missmatch?''; END IF; return sr; END; ' LANGUAGE plpgsql IMMUTABLE; -- -- TOC entry 97 (OID 31776) -- Name: get_proj4_from_srid(integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION get_proj4_from_srid(integer) RETURNS text AS 'SELECT proj4text::text FROM spatial_ref_sys WHERE srid= $1' LANGUAGE sql IMMUTABLE STRICT; -- -- TOC entry 98 (OID 31777) -- Name: find_extent(text, text); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION find_extent(text, text) RETURNS box3d AS ' DECLARE tablename alias for $1; columnname alias for $2; okay boolean; myrec RECORD; BEGIN FOR myrec IN EXECUTE ''SELECT extent("''||columnname||''") FROM "''||tablename||''"'' LOOP return myrec.extent; END LOOP; END; ' LANGUAGE plpgsql STRICT; -- -- TOC entry 99 (OID 31778) -- Name: transform_geometry(geometry, text, text, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION transform_geometry(geometry, text, text, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'transform_geom' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 100 (OID 31779) -- Name: transform(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION transform(geometry, integer) RETURNS geometry AS 'BEGIN RETURN transform_geometry( $1 , get_proj4_from_srid(SRID( $1 ) ), get_proj4_from_srid( $2 ), $2 ); END;' LANGUAGE plpgsql IMMUTABLE STRICT; -- -- TOC entry 101 (OID 31780) -- Name: srid(chip); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION srid(chip) RETURNS integer AS '$libdir/libpostgis.so.0.8', 'srid_chip' LANGUAGE c STRICT; -- -- TOC entry 102 (OID 31781) -- Name: height(chip); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION height(chip) RETURNS integer AS '$libdir/libpostgis.so.0.8', 'height_chip' LANGUAGE c STRICT; -- -- TOC entry 103 (OID 31782) -- Name: factor(chip); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION factor(chip) RETURNS real AS '$libdir/libpostgis.so.0.8', 'factor_chip' LANGUAGE c STRICT; -- -- TOC entry 104 (OID 31783) -- Name: width(chip); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION width(chip) RETURNS integer AS '$libdir/libpostgis.so.0.8', 'width_chip' LANGUAGE c STRICT; -- -- TOC entry 105 (OID 31784) -- Name: datatype(chip); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION datatype(chip) RETURNS integer AS '$libdir/libpostgis.so.0.8', 'datatype_chip' LANGUAGE c STRICT; -- -- TOC entry 106 (OID 31785) -- Name: compression(chip); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION compression(chip) RETURNS integer AS '$libdir/libpostgis.so.0.8', 'compression_chip' LANGUAGE c STRICT; -- -- TOC entry 107 (OID 31786) -- Name: setsrid(chip, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION setsrid(chip, integer) RETURNS chip AS '$libdir/libpostgis.so.0.8', 'setsrid_chip' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 108 (OID 31787) -- Name: setfactor(chip, real); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION setfactor(chip, real) RETURNS chip AS '$libdir/libpostgis.so.0.8', 'setfactor_chip' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 109 (OID 31788) -- Name: geometry(chip); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometry(chip) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'CHIP_to_geom' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 110 (OID 31789) -- Name: box3d(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION box3d(geometry) RETURNS box3d AS '$libdir/libpostgis.so.0.8', 'get_bbox_of_geometry' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 111 (OID 31790) -- Name: box(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION box(geometry) RETURNS box AS '$libdir/libpostgis.so.0.8', 'geometry2box' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 112 (OID 31791) -- Name: geometry(box3d); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometry(box3d) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'get_geometry_of_bbox' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 113 (OID 31792) -- Name: geometry(text); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometry(text) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_text' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 114 (OID 31793) -- Name: expand(box3d, double precision); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION expand(box3d, double precision) RETURNS box3d AS '$libdir/libpostgis.so.0.8', 'expand_bbox' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 115 (OID 31794) -- Name: asbinary(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION asbinary(geometry) RETURNS wkb AS '$libdir/libpostgis.so.0.8', 'asbinary_simple' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 116 (OID 31795) -- Name: asbinary(geometry, text); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION asbinary(geometry, text) RETURNS wkb AS '$libdir/libpostgis.so.0.8', 'asbinary_specify' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 117 (OID 31796) -- Name: bytea(wkb); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION bytea(wkb) RETURNS bytea AS '$libdir/libpostgis.so.0.8', 'WKBtoBYTEA' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 9 (OID 31747) -- Name: wkb; Type: TYPE; Schema: public; Owner: postgres -- CREATE TYPE wkb ( INTERNALLENGTH = variable, INPUT = wkb_in, OUTPUT = wkb_out, RECEIVE = wkb_recv, SEND = bytea, ALIGNMENT = int4, STORAGE = extended ); -- -- TOC entry 118 (OID 31797) -- Name: geometry(wkb); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometry(wkb) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometryfromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 119 (OID 31798) -- Name: geomfromwkb(wkb); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geomfromwkb(wkb) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometryfromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 120 (OID 31799) -- Name: geomfromwkb(wkb, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geomfromwkb(wkb, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometryfromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 121 (OID 31800) -- Name: pointfromwkb(wkb, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION pointfromwkb(wkb, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'PointfromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 122 (OID 31801) -- Name: pointfromwkb(wkb); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION pointfromwkb(wkb) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'PointfromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 123 (OID 31802) -- Name: linefromwkb(wkb, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION linefromwkb(wkb, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'LinefromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 124 (OID 31803) -- Name: linefromwkb(wkb); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION linefromwkb(wkb) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'LinefromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 125 (OID 31804) -- Name: linestringfromwkb(wkb, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION linestringfromwkb(wkb, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'LinefromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 126 (OID 31805) -- Name: linestringfromwkb(wkb); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION linestringfromwkb(wkb) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'LinefromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 127 (OID 31806) -- Name: polyfromwkb(wkb, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION polyfromwkb(wkb, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'PolyfromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 128 (OID 31807) -- Name: polyfromwkb(wkb); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION polyfromwkb(wkb) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'PolyfromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 129 (OID 31808) -- Name: polygonfromwkb(wkb, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION polygonfromwkb(wkb, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'PolyfromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 130 (OID 31809) -- Name: polygonfromwkb(wkb); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION polygonfromwkb(wkb) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'PolyfromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 131 (OID 31810) -- Name: mpointfromwkb(wkb, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION mpointfromwkb(wkb, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'MPointfromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 132 (OID 31811) -- Name: mpointfromwkb(wkb); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION mpointfromwkb(wkb) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'MPointfromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 133 (OID 31812) -- Name: multipointfromwkb(wkb, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION multipointfromwkb(wkb, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'MPointfromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 134 (OID 31813) -- Name: multipointfromwkb(wkb); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION multipointfromwkb(wkb) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'MPointfromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 135 (OID 31814) -- Name: multilinefromwkb(wkb, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION multilinefromwkb(wkb, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'MLinefromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 136 (OID 31815) -- Name: multilinefromwkb(wkb); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION multilinefromwkb(wkb) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'MLinefromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 137 (OID 31816) -- Name: mlinefromwkb(wkb, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION mlinefromwkb(wkb, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'MLinefromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 138 (OID 31817) -- Name: mlinefromwkb(wkb); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION mlinefromwkb(wkb) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'MLinefromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 139 (OID 31818) -- Name: mpolyfromwkb(wkb, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION mpolyfromwkb(wkb, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'MPolyfromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 140 (OID 31819) -- Name: mpolyfromwkb(wkb); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION mpolyfromwkb(wkb) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'MPolyfromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 141 (OID 31820) -- Name: multipolyfromwkb(wkb, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION multipolyfromwkb(wkb, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'MPolyfromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 142 (OID 31821) -- Name: multipolyfromwkb(wkb); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION multipolyfromwkb(wkb) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'MPolyfromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 143 (OID 31822) -- Name: geomcollfromwkb(wkb, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geomcollfromwkb(wkb, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'GCfromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 144 (OID 31823) -- Name: geomcollfromwkb(wkb); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geomcollfromwkb(wkb) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'GCfromWKB_SRID' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 145 (OID 31824) -- Name: npoints(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION npoints(geometry) RETURNS integer AS '$libdir/libpostgis.so.0.8', 'npoints' LANGUAGE c STRICT; -- -- TOC entry 146 (OID 31825) -- Name: nrings(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION nrings(geometry) RETURNS integer AS '$libdir/libpostgis.so.0.8', 'nrings' LANGUAGE c STRICT; -- -- TOC entry 147 (OID 31826) -- Name: mem_size(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION mem_size(geometry) RETURNS integer AS '$libdir/libpostgis.so.0.8', 'mem_size' LANGUAGE c STRICT; -- -- TOC entry 148 (OID 31827) -- Name: summary(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION summary(geometry) RETURNS text AS '$libdir/libpostgis.so.0.8', 'summary' LANGUAGE c STRICT; -- -- TOC entry 149 (OID 31828) -- Name: translate(geometry, double precision, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION translate(geometry, double precision, double precision, double precision) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'translate' LANGUAGE c STRICT; -- -- TOC entry 150 (OID 31829) -- Name: dimension(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION dimension(geometry) RETURNS integer AS '$libdir/libpostgis.so.0.8', 'dimension' LANGUAGE c STRICT; -- -- TOC entry 151 (OID 31830) -- Name: geometrytype(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometrytype(geometry) RETURNS text AS '$libdir/libpostgis.so.0.8', 'geometrytype' LANGUAGE c STRICT; -- -- TOC entry 152 (OID 31831) -- Name: envelope(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION envelope(geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'envelope' LANGUAGE c STRICT; -- -- TOC entry 153 (OID 31832) -- Name: x(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION x(geometry) RETURNS double precision AS '$libdir/libpostgis.so.0.8', 'x_point' LANGUAGE c STRICT; -- -- TOC entry 154 (OID 31833) -- Name: y(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION y(geometry) RETURNS double precision AS '$libdir/libpostgis.so.0.8', 'y_point' LANGUAGE c STRICT; -- -- TOC entry 155 (OID 31834) -- Name: z(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION z(geometry) RETURNS double precision AS '$libdir/libpostgis.so.0.8', 'z_point' LANGUAGE c STRICT; -- -- TOC entry 156 (OID 31835) -- Name: numpoints(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION numpoints(geometry) RETURNS integer AS '$libdir/libpostgis.so.0.8', 'numpoints_linestring' LANGUAGE c STRICT; -- -- TOC entry 157 (OID 31836) -- Name: pointn(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION pointn(geometry, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'pointn_linestring' LANGUAGE c STRICT; -- -- TOC entry 158 (OID 31837) -- Name: exteriorring(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION exteriorring(geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'exteriorring_polygon' LANGUAGE c STRICT; -- -- TOC entry 159 (OID 31838) -- Name: numinteriorrings(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION numinteriorrings(geometry) RETURNS integer AS '$libdir/libpostgis.so.0.8', 'numinteriorrings_polygon' LANGUAGE c STRICT; -- -- TOC entry 160 (OID 31839) -- Name: interiorringn(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION interiorringn(geometry, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'interiorringn_polygon' LANGUAGE c STRICT; -- -- TOC entry 161 (OID 31840) -- Name: numgeometries(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION numgeometries(geometry) RETURNS integer AS '$libdir/libpostgis.so.0.8', 'numgeometries_collection' LANGUAGE c STRICT; -- -- TOC entry 162 (OID 31841) -- Name: geometryn(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometryn(geometry, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometryn_collection' LANGUAGE c STRICT; -- -- TOC entry 163 (OID 31842) -- Name: max_distance(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION max_distance(geometry, geometry) RETURNS double precision AS '$libdir/libpostgis.so.0.8', 'max_distance' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 164 (OID 31843) -- Name: optimistic_overlap(geometry, geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION optimistic_overlap(geometry, geometry, double precision) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'optimistic_overlap' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 165 (OID 31844) -- Name: segmentize(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION segmentize(geometry, double precision) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'segmentize' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 166 (OID 31845) -- Name: distance(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION distance(geometry, geometry) RETURNS double precision AS '$libdir/libpostgis.so.0.8', 'distance' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 167 (OID 31846) -- Name: astext(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION astext(geometry) RETURNS text AS '$libdir/libpostgis.so.0.8', 'astext_geometry' LANGUAGE c STRICT; -- -- TOC entry 168 (OID 31847) -- Name: srid(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION srid(geometry) RETURNS integer AS '$libdir/libpostgis.so.0.8', 'srid_geom' LANGUAGE c STRICT; -- -- TOC entry 169 (OID 31848) -- Name: geometryfromtext(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometryfromtext(geometry, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 170 (OID 31849) -- Name: geometryfromtext(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometryfromtext(geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 171 (OID 31850) -- Name: geomfromtext(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geomfromtext(geometry, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 172 (OID 31851) -- Name: geomfromtext(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geomfromtext(geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 173 (OID 31852) -- Name: polyfromtext(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION polyfromtext(geometry, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text_poly' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 174 (OID 31853) -- Name: polygonfromtext(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION polygonfromtext(geometry, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text_poly' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 175 (OID 31854) -- Name: polygonfromtext(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION polygonfromtext(geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text_poly' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 176 (OID 31855) -- Name: mpolyfromtext(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION mpolyfromtext(geometry, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text_mpoly' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 177 (OID 31856) -- Name: linefromtext(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION linefromtext(geometry, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text_line' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 178 (OID 31857) -- Name: mlinefromtext(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION mlinefromtext(geometry, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text_mline' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 179 (OID 31858) -- Name: multilinestringfromtext(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION multilinestringfromtext(geometry, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text_mline' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 180 (OID 31859) -- Name: multilinestringfromtext(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION multilinestringfromtext(geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text_mline' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 181 (OID 31860) -- Name: pointfromtext(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION pointfromtext(geometry, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text_point' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 182 (OID 31861) -- Name: mpointfromtext(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION mpointfromtext(geometry, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text_mpoint' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 183 (OID 31862) -- Name: multipointfromtext(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION multipointfromtext(geometry, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text_mpoint' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 184 (OID 31863) -- Name: multipointfromtext(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION multipointfromtext(geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text_mpoint' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 185 (OID 31864) -- Name: geomcollfromtext(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geomcollfromtext(geometry, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text_gc' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 186 (OID 31865) -- Name: setsrid(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION setsrid(geometry, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 187 (OID 31866) -- Name: polyfromtext(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION polyfromtext(geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text_poly' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 188 (OID 31867) -- Name: mpolyfromtext(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION mpolyfromtext(geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text_mpoly' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 189 (OID 31868) -- Name: multipolygonfromtext(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION multipolygonfromtext(geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text_mpoly' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 190 (OID 31869) -- Name: multipolygonfromtext(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION multipolygonfromtext(geometry, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text_mpoly' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 191 (OID 31870) -- Name: linefromtext(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION linefromtext(geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text_line' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 192 (OID 31871) -- Name: linestringfromtext(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION linestringfromtext(geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text_line' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 193 (OID 31872) -- Name: linestringfromtext(geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION linestringfromtext(geometry, integer) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text_line' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 194 (OID 31873) -- Name: mlinefromtext(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION mlinefromtext(geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text_mline' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 195 (OID 31874) -- Name: pointfromtext(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION pointfromtext(geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text_point' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 196 (OID 31875) -- Name: mpointfromtext(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION mpointfromtext(geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text_mpoint' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 197 (OID 31876) -- Name: geomcollfromtext(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geomcollfromtext(geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_from_text_gc' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 198 (OID 31877) -- Name: isempty(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION isempty(geometry) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'isempty' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 199 (OID 31878) -- Name: issimple(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION issimple(geometry) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'issimple' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 200 (OID 31879) -- Name: equals(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION equals(geometry, geometry) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'geomequals' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 201 (OID 31880) -- Name: length_spheroid(geometry, spheroid); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION length_spheroid(geometry, spheroid) RETURNS double precision AS '$libdir/libpostgis.so.0.8', 'length_ellipsoid' LANGUAGE c STRICT; -- -- TOC entry 202 (OID 31881) -- Name: length3d_spheroid(geometry, spheroid); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION length3d_spheroid(geometry, spheroid) RETURNS double precision AS '$libdir/libpostgis.so.0.8', 'length3d_ellipsoid' LANGUAGE c STRICT; -- -- TOC entry 203 (OID 31882) -- Name: distance_spheroid(geometry, geometry, spheroid); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION distance_spheroid(geometry, geometry, spheroid) RETURNS double precision AS '$libdir/libpostgis.so.0.8', 'distance_ellipsoid' LANGUAGE c STRICT; -- -- TOC entry 204 (OID 31883) -- Name: length3d(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION length3d(geometry) RETURNS double precision AS '$libdir/libpostgis.so.0.8', 'length3d' LANGUAGE c STRICT; -- -- TOC entry 205 (OID 31884) -- Name: length(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION length(geometry) RETURNS double precision AS '$libdir/libpostgis.so.0.8', 'length2d' LANGUAGE c STRICT; -- -- TOC entry 206 (OID 31885) -- Name: area2d(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION area2d(geometry) RETURNS double precision AS '$libdir/libpostgis.so.0.8', 'area2d' LANGUAGE c STRICT; -- -- TOC entry 207 (OID 31886) -- Name: area(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION area(geometry) RETURNS double precision AS '$libdir/libpostgis.so.0.8', 'area2d' LANGUAGE c STRICT; -- -- TOC entry 208 (OID 31887) -- Name: perimeter3d(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION perimeter3d(geometry) RETURNS double precision AS '$libdir/libpostgis.so.0.8', 'perimeter3d' LANGUAGE c STRICT; -- -- TOC entry 209 (OID 31888) -- Name: perimeter(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION perimeter(geometry) RETURNS double precision AS '$libdir/libpostgis.so.0.8', 'perimeter2d' LANGUAGE c STRICT; -- -- TOC entry 210 (OID 31889) -- Name: point_inside_circle(geometry, double precision, double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION point_inside_circle(geometry, double precision, double precision, double precision) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'point_inside_circle' LANGUAGE c STRICT; -- -- TOC entry 211 (OID 31890) -- Name: startpoint(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION startpoint(geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'startpoint' LANGUAGE c STRICT; -- -- TOC entry 212 (OID 31891) -- Name: endpoint(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION endpoint(geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'endpoint' LANGUAGE c STRICT; -- -- TOC entry 213 (OID 31892) -- Name: isclosed(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION isclosed(geometry) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'isclosed' LANGUAGE c STRICT; -- -- TOC entry 214 (OID 31893) -- Name: centroid(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION centroid(geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'centroid' LANGUAGE c STRICT; -- -- TOC entry 215 (OID 31894) -- Name: isring(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION isring(geometry) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'isring' LANGUAGE c STRICT; -- -- TOC entry 216 (OID 31895) -- Name: pointonsurface(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION pointonsurface(geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'pointonsurface' LANGUAGE c STRICT; -- -- TOC entry 217 (OID 31896) -- Name: xmin(box3d); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION xmin(box3d) RETURNS double precision AS '$libdir/libpostgis.so.0.8', 'box3d_xmin' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 218 (OID 31897) -- Name: ymin(box3d); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION ymin(box3d) RETURNS double precision AS '$libdir/libpostgis.so.0.8', 'box3d_ymin' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 219 (OID 31898) -- Name: zmin(box3d); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION zmin(box3d) RETURNS double precision AS '$libdir/libpostgis.so.0.8', 'box3d_zmin' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 220 (OID 31899) -- Name: xmax(box3d); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION xmax(box3d) RETURNS double precision AS '$libdir/libpostgis.so.0.8', 'box3d_xmax' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 221 (OID 31900) -- Name: ymax(box3d); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION ymax(box3d) RETURNS double precision AS '$libdir/libpostgis.so.0.8', 'box3d_ymax' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 222 (OID 31901) -- Name: zmax(box3d); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION zmax(box3d) RETURNS double precision AS '$libdir/libpostgis.so.0.8', 'box3d_zmax' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 223 (OID 31902) -- Name: box3dtobox(box3d); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION box3dtobox(box3d) RETURNS box AS '$libdir/libpostgis.so.0.8', 'box3dtobox' LANGUAGE c IMMUTABLE STRICT; -- -- TOC entry 224 (OID 31903) -- Name: geom_accum(geometry[], geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geom_accum(geometry[], geometry) RETURNS geometry[] AS '$libdir/libpostgis.so.0.8', 'geom_accum' LANGUAGE c; -- -- TOC entry 225 (OID 31904) -- Name: combine_bbox(box3d, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION combine_bbox(box3d, geometry) RETURNS box3d AS '$libdir/libpostgis.so.0.8', 'combine_bbox' LANGUAGE c; -- -- TOC entry 375 (OID 31905) -- Name: extent(geometry); Type: AGGREGATE; Schema: public; Owner: postgres -- CREATE AGGREGATE extent ( BASETYPE = geometry, SFUNC = combine_bbox, STYPE = box3d ); -- -- TOC entry 226 (OID 31906) -- Name: collector(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION collector(geometry, geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'collector' LANGUAGE c; -- -- TOC entry 376 (OID 31907) -- Name: memcollect(geometry); Type: AGGREGATE; Schema: public; Owner: postgres -- CREATE AGGREGATE memcollect ( BASETYPE = geometry, SFUNC = collector, STYPE = geometry ); -- -- TOC entry 227 (OID 31908) -- Name: collect_garray(geometry[]); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION collect_garray(geometry[]) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'collect_garray' LANGUAGE c; -- -- TOC entry 377 (OID 31909) -- Name: collect(geometry); Type: AGGREGATE; Schema: public; Owner: postgres -- CREATE AGGREGATE collect ( BASETYPE = geometry, SFUNC = geom_accum, STYPE = geometry[], FINALFUNC = collect_garray ); -- -- TOC entry 228 (OID 31910) -- Name: geometry_overleft(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometry_overleft(geometry, geometry) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'geometry_overleft' LANGUAGE c STRICT; -- -- TOC entry 229 (OID 31911) -- Name: geometry_overright(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometry_overright(geometry, geometry) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'geometry_overright' LANGUAGE c STRICT; -- -- TOC entry 230 (OID 31912) -- Name: geometry_left(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometry_left(geometry, geometry) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'geometry_left' LANGUAGE c STRICT; -- -- TOC entry 231 (OID 31913) -- Name: geometry_right(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometry_right(geometry, geometry) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'geometry_right' LANGUAGE c STRICT; -- -- TOC entry 232 (OID 31914) -- Name: geometry_contain(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometry_contain(geometry, geometry) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'geometry_contain' LANGUAGE c STRICT; -- -- TOC entry 233 (OID 31915) -- Name: geometry_contained(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometry_contained(geometry, geometry) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'geometry_contained' LANGUAGE c STRICT; -- -- TOC entry 234 (OID 31916) -- Name: geometry_overlap(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometry_overlap(geometry, geometry) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'geometry_overlap' LANGUAGE c STRICT; -- -- TOC entry 235 (OID 31917) -- Name: geometry_same(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometry_same(geometry, geometry) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'geometry_same' LANGUAGE c STRICT; -- -- TOC entry 236 (OID 31918) -- Name: geometry_lt(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometry_lt(geometry, geometry) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'geometry_lt' LANGUAGE c STRICT; -- -- TOC entry 237 (OID 31919) -- Name: geometry_le(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometry_le(geometry, geometry) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'geometry_le' LANGUAGE c STRICT; -- -- TOC entry 238 (OID 31920) -- Name: geometry_gt(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometry_gt(geometry, geometry) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'geometry_gt' LANGUAGE c STRICT; -- -- TOC entry 239 (OID 31921) -- Name: geometry_ge(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometry_ge(geometry, geometry) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'geometry_ge' LANGUAGE c STRICT; -- -- TOC entry 240 (OID 31922) -- Name: geometry_eq(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometry_eq(geometry, geometry) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'geometry_eq' LANGUAGE c STRICT; -- -- TOC entry 241 (OID 31923) -- Name: geometry_cmp(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometry_cmp(geometry, geometry) RETURNS integer AS '$libdir/libpostgis.so.0.8', 'geometry_cmp' LANGUAGE c STRICT; -- -- TOC entry 242 (OID 31924) -- Name: force_2d(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION force_2d(geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'force_2d' LANGUAGE c STRICT; -- -- TOC entry 243 (OID 31925) -- Name: force_3d(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION force_3d(geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'force_3d' LANGUAGE c STRICT; -- -- TOC entry 244 (OID 31926) -- Name: force_collection(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION force_collection(geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'force_collection' LANGUAGE c STRICT; -- -- TOC entry 388 (OID 31927) -- Name: >>; Type: OPERATOR; Schema: public; Owner: postgres -- CREATE OPERATOR >> ( PROCEDURE = geometry_right, LEFTARG = geometry, RIGHTARG = geometry, COMMUTATOR = <<, RESTRICT = positionsel, JOIN = positionjoinsel ); -- -- TOC entry 381 (OID 31928) -- Name: <<; Type: OPERATOR; Schema: public; Owner: postgres -- CREATE OPERATOR << ( PROCEDURE = geometry_left, LEFTARG = geometry, RIGHTARG = geometry, COMMUTATOR = >>, RESTRICT = positionsel, JOIN = positionjoinsel ); -- -- TOC entry 387 (OID 31929) -- Name: &>; Type: OPERATOR; Schema: public; Owner: postgres -- CREATE OPERATOR &> ( PROCEDURE = geometry_overright, LEFTARG = geometry, RIGHTARG = geometry, COMMUTATOR = &<, RESTRICT = positionsel, JOIN = positionjoinsel ); -- -- TOC entry 384 (OID 31930) -- Name: &<; Type: OPERATOR; Schema: public; Owner: postgres -- CREATE OPERATOR &< ( PROCEDURE = geometry_overleft, LEFTARG = geometry, RIGHTARG = geometry, COMMUTATOR = &>, RESTRICT = positionsel, JOIN = positionjoinsel ); -- -- TOC entry 386 (OID 31931) -- Name: &&; Type: OPERATOR; Schema: public; Owner: postgres -- CREATE OPERATOR && ( PROCEDURE = geometry_overlap, LEFTARG = geometry, RIGHTARG = geometry, COMMUTATOR = &&, RESTRICT = postgis_gist_sel, JOIN = positionjoinsel ); -- -- TOC entry 389 (OID 31932) -- Name: ~=; Type: OPERATOR; Schema: public; Owner: postgres -- CREATE OPERATOR ~= ( PROCEDURE = geometry_same, LEFTARG = geometry, RIGHTARG = geometry, COMMUTATOR = ~=, RESTRICT = eqsel, JOIN = eqjoinsel ); -- -- TOC entry 391 (OID 31933) -- Name: ~; Type: OPERATOR; Schema: public; Owner: postgres -- CREATE OPERATOR ~ ( PROCEDURE = geometry_contain, LEFTARG = geometry, RIGHTARG = geometry, COMMUTATOR = @, RESTRICT = contsel, JOIN = contjoinsel ); -- -- TOC entry 390 (OID 31934) -- Name: @; Type: OPERATOR; Schema: public; Owner: postgres -- CREATE OPERATOR @ ( PROCEDURE = geometry_contained, LEFTARG = geometry, RIGHTARG = geometry, COMMUTATOR = ~, RESTRICT = contsel, JOIN = contjoinsel ); -- -- TOC entry 385 (OID 31935) -- Name: >; Type: OPERATOR; Schema: public; Owner: postgres -- CREATE OPERATOR > ( PROCEDURE = geometry_gt, LEFTARG = geometry, RIGHTARG = geometry, COMMUTATOR = <, NEGATOR = <=, RESTRICT = contsel, JOIN = contjoinsel ); -- -- TOC entry 383 (OID 31936) -- Name: >=; Type: OPERATOR; Schema: public; Owner: postgres -- CREATE OPERATOR >= ( PROCEDURE = geometry_ge, LEFTARG = geometry, RIGHTARG = geometry, COMMUTATOR = <=, NEGATOR = <, RESTRICT = contsel, JOIN = contjoinsel ); -- -- TOC entry 392 (OID 31937) -- Name: <; Type: OPERATOR; Schema: public; Owner: postgres -- CREATE OPERATOR < ( PROCEDURE = geometry_lt, LEFTARG = geometry, RIGHTARG = geometry, COMMUTATOR = >, NEGATOR = >=, RESTRICT = contsel, JOIN = contjoinsel ); -- -- TOC entry 380 (OID 31938) -- Name: <=; Type: OPERATOR; Schema: public; Owner: postgres -- CREATE OPERATOR <= ( PROCEDURE = geometry_le, LEFTARG = geometry, RIGHTARG = geometry, COMMUTATOR = >=, NEGATOR = >, RESTRICT = contsel, JOIN = contjoinsel ); -- -- TOC entry 382 (OID 31939) -- Name: =; Type: OPERATOR; Schema: public; Owner: postgres -- CREATE OPERATOR = ( PROCEDURE = geometry_eq, LEFTARG = geometry, RIGHTARG = geometry, COMMUTATOR = =, RESTRICT = contsel, JOIN = contjoinsel ); -- -- TOC entry 245 (OID 31940) -- Name: intersection(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION intersection(geometry, geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'intersection' LANGUAGE c STRICT; -- -- TOC entry 246 (OID 31941) -- Name: buffer(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION buffer(geometry, double precision) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'buffer' LANGUAGE c STRICT; -- -- TOC entry 247 (OID 31942) -- Name: convexhull(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION convexhull(geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'convexhull' LANGUAGE c STRICT; -- -- TOC entry 248 (OID 31943) -- Name: difference(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION difference(geometry, geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'difference' LANGUAGE c STRICT; -- -- TOC entry 249 (OID 31944) -- Name: boundary(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION boundary(geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'boundary' LANGUAGE c STRICT; -- -- TOC entry 250 (OID 31945) -- Name: symdifference(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION symdifference(geometry, geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'symdifference' LANGUAGE c STRICT; -- -- TOC entry 251 (OID 31946) -- Name: symmetricdifference(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION symmetricdifference(geometry, geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'symdifference' LANGUAGE c STRICT; -- -- TOC entry 252 (OID 31947) -- Name: geomunion(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geomunion(geometry, geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geomunion' LANGUAGE c STRICT; -- -- TOC entry 378 (OID 31948) -- Name: memgeomunion(geometry); Type: AGGREGATE; Schema: public; Owner: postgres -- CREATE AGGREGATE memgeomunion ( BASETYPE = geometry, SFUNC = public.geomunion, STYPE = geometry ); -- -- TOC entry 253 (OID 31949) -- Name: unite_garray(geometry[]); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION unite_garray(geometry[]) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'unite_garray' LANGUAGE c; -- -- TOC entry 379 (OID 31950) -- Name: geomunion(geometry); Type: AGGREGATE; Schema: public; Owner: postgres -- CREATE AGGREGATE geomunion ( BASETYPE = geometry, SFUNC = geom_accum, STYPE = geometry[], FINALFUNC = unite_garray ); -- -- TOC entry 254 (OID 31951) -- Name: relate(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION relate(geometry, geometry) RETURNS text AS '$libdir/libpostgis.so.0.8', 'relate_full' LANGUAGE c STRICT; -- -- TOC entry 255 (OID 31952) -- Name: relate(geometry, geometry, text); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION relate(geometry, geometry, text) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'relate_pattern' LANGUAGE c STRICT; -- -- TOC entry 256 (OID 31953) -- Name: disjoint(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION disjoint(geometry, geometry) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'disjoint' LANGUAGE c STRICT; -- -- TOC entry 257 (OID 31954) -- Name: touches(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION touches(geometry, geometry) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'touches' LANGUAGE c STRICT; -- -- TOC entry 258 (OID 31955) -- Name: intersects(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION intersects(geometry, geometry) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'intersects' LANGUAGE c STRICT; -- -- TOC entry 259 (OID 31956) -- Name: crosses(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION crosses(geometry, geometry) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'crosses' LANGUAGE c STRICT; -- -- TOC entry 260 (OID 31957) -- Name: within(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION within(geometry, geometry) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'within' LANGUAGE c STRICT; -- -- TOC entry 261 (OID 31958) -- Name: contains(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION contains(geometry, geometry) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'contains' LANGUAGE c STRICT; -- -- TOC entry 262 (OID 31959) -- Name: overlaps(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION "overlaps"(geometry, geometry) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'overlaps' LANGUAGE c STRICT; -- -- TOC entry 263 (OID 31960) -- Name: isvalid(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION isvalid(geometry) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'isvalid' LANGUAGE c STRICT; -- -- TOC entry 264 (OID 31961) -- Name: geosnoop(geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geosnoop(geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'GEOSnoop' LANGUAGE c STRICT; -- -- TOC entry 265 (OID 31962) -- Name: simplify(geometry, double precision); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION simplify(geometry, double precision) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'simplify' LANGUAGE c STRICT; SET SESSION AUTHORIZATION DEFAULT; -- -- TOC entry 401 (OID 31964) -- Name: CAST (public.chip AS public.geometry); Type: CAST; Schema: public; Owner: -- CREATE CAST (public.chip AS public.geometry) WITH FUNCTION geometry(public.chip) AS IMPLICIT; -- -- TOC entry 402 (OID 31965) -- Name: CAST (public.geometry AS public.box3d); Type: CAST; Schema: public; Owner: -- CREATE CAST (public.geometry AS public.box3d) WITH FUNCTION box3d(public.geometry) AS IMPLICIT; -- -- TOC entry 403 (OID 31966) -- Name: CAST (public.geometry AS box); Type: CAST; Schema: public; Owner: -- CREATE CAST (public.geometry AS box) WITH FUNCTION box(public.geometry) AS IMPLICIT; -- -- TOC entry 404 (OID 31967) -- Name: CAST (public.box3d AS public.geometry); Type: CAST; Schema: public; Owner: -- CREATE CAST (public.box3d AS public.geometry) WITH FUNCTION geometry(public.box3d) AS IMPLICIT; SET search_path = pg_catalog; -- -- TOC entry 405 (OID 31968) -- Name: CAST (text AS public.geometry); Type: CAST; Schema: pg_catalog; Owner: -- CREATE CAST (text AS public.geometry) WITH FUNCTION geometry(text) AS IMPLICIT; SET search_path = public, pg_catalog; -- -- TOC entry 406 (OID 31969) -- Name: CAST (public.wkb AS bytea); Type: CAST; Schema: public; Owner: -- CREATE CAST (public.wkb AS bytea) WITH FUNCTION bytea(public.wkb) AS IMPLICIT; -- -- TOC entry 407 (OID 31970) -- Name: CAST (public.box3d AS box); Type: CAST; Schema: public; Owner: -- CREATE CAST (public.box3d AS box) WITH FUNCTION box3dtobox(public.box3d); -- -- TOC entry 408 (OID 31971) -- Name: CAST (public.geometry AS text); Type: CAST; Schema: public; Owner: -- CREATE CAST (public.geometry AS text) WITH FUNCTION astext(public.geometry); SET SESSION AUTHORIZATION 'postgres'; -- -- TOC entry 266 (OID 31972) -- Name: update_geometry_stats(); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION update_geometry_stats() RETURNS text AS ' BEGIN EXECUTE ''update geometry_columns set attrelid = (select pg_class.oid AS attrelid from pg_class,pg_attribute where relname =geometry_columns.f_table_name::name and pg_attribute.attrelid = pg_class.oid and pg_attribute.attname = geometry_columns.f_geometry_column::name), varattnum = (select pg_attribute.attnum from pg_class,pg_attribute where relname =geometry_columns.f_table_name::name and pg_attribute.attrelid = pg_class.oid and pg_attribute.attname = geometry_columns.f_geometry_column::name)''; execute ''update geometry_columns set stats = (build_histogram2d( create_histogram2d(find_extent(f_table_name,f_geometry_column),40 ),f_table_name::text, f_geometry_column::text)) ''; return ''done''; END; ' LANGUAGE plpgsql; -- -- TOC entry 267 (OID 31973) -- Name: update_geometry_stats(character varying, character varying); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION update_geometry_stats(character varying, character varying) RETURNS text AS ' DECLARE tablename aliAS for $1; columnname aliAS for $2; BEGIN EXECUTE ''update geometry_columns set attrelid = (select pg_class.oid AS attrelid from pg_class,pg_attribute where relname =geometry_columns.f_table_name::name and pg_attribute.attrelid = pg_class.oid and pg_attribute.attname = geometry_columns.f_geometry_column::name), varattnum = (select pg_attribute.attnum from pg_class,pg_attribute where relname =geometry_columns.f_table_name::name and pg_attribute.attrelid = pg_class.oid and pg_attribute.attname = geometry_columns.f_geometry_column::name)''; execute ''update geometry_columns set stats = (build_histogram2d( create_histogram2d(find_extent(''|| quote_literal(tablename) || '',''||quote_literal(columnname) ||''),40 ),''|| quote_literal(tablename) || ''::text,''||quote_literal(columnname) ||''::text )) WHERE f_table_name=''|| quote_literal(tablename) || ''and f_geometry_column=''||quote_literal(columnname) ; return ''done''; END; ' LANGUAGE plpgsql; -- -- TOC entry 268 (OID 31974) -- Name: create_histogram2d(box3d, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION create_histogram2d(box3d, integer) RETURNS histogram2d AS '$libdir/libpostgis.so.0.8', 'create_histogram2d' LANGUAGE c STRICT; -- -- TOC entry 269 (OID 31975) -- Name: build_histogram2d(histogram2d, text, text); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION build_histogram2d(histogram2d, text, text) RETURNS histogram2d AS '$libdir/libpostgis.so.0.8', 'build_histogram2d' LANGUAGE c STRICT; -- -- TOC entry 270 (OID 31976) -- Name: explode_histogram2d(histogram2d, text); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION explode_histogram2d(histogram2d, text) RETURNS histogram2d AS '$libdir/libpostgis.so.0.8', 'explode_histogram2d' LANGUAGE c STRICT; -- -- TOC entry 271 (OID 31977) -- Name: estimate_histogram2d(histogram2d, box); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION estimate_histogram2d(histogram2d, box) RETURNS double precision AS '$libdir/libpostgis.so.0.8', 'estimate_histogram2d' LANGUAGE c STRICT; -- -- TOC entry 272 (OID 31978) -- Name: postgisgistcostestimate(internal, internal, internal, internal, internal, internal, internal, internal); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION postgisgistcostestimate(internal, internal, internal, internal, internal, internal, internal, internal) RETURNS opaque AS '$libdir/libpostgis.so.0.8', 'postgisgistcostestimate' LANGUAGE c STRICT; -- -- TOC entry 273 (OID 31979) -- Name: ggeometry_consistent(internal, geometry, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION ggeometry_consistent(internal, geometry, integer) RETURNS boolean AS '$libdir/libpostgis.so.0.8', 'ggeometry_consistent' LANGUAGE c; -- -- TOC entry 274 (OID 31980) -- Name: ggeometry_compress(internal); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION ggeometry_compress(internal) RETURNS internal AS '$libdir/libpostgis.so.0.8', 'ggeometry_compress' LANGUAGE c; -- -- TOC entry 275 (OID 31981) -- Name: gbox_penalty(internal, internal, internal); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION gbox_penalty(internal, internal, internal) RETURNS internal AS '$libdir/libpostgis.so.0.8', 'gbox_penalty' LANGUAGE c; -- -- TOC entry 276 (OID 31982) -- Name: gbox_picksplit(internal, internal); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION gbox_picksplit(internal, internal) RETURNS internal AS '$libdir/libpostgis.so.0.8', 'gbox_picksplit' LANGUAGE c; -- -- TOC entry 277 (OID 31983) -- Name: gbox_union(bytea, internal); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION gbox_union(bytea, internal) RETURNS internal AS '$libdir/libpostgis.so.0.8', 'gbox_union' LANGUAGE c; -- -- TOC entry 278 (OID 31984) -- Name: gbox_same(box, box, internal); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION gbox_same(box, box, internal) RETURNS internal AS '$libdir/libpostgis.so.0.8', 'gbox_same' LANGUAGE c; -- -- TOC entry 279 (OID 31985) -- Name: rtree_decompress(internal); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION rtree_decompress(internal) RETURNS internal AS '$libdir/libpostgis.so.0.8', 'rtree_decompress' LANGUAGE c; -- -- TOC entry 280 (OID 31986) -- Name: geometry_union(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometry_union(geometry, geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_union' LANGUAGE c; -- -- TOC entry 281 (OID 31987) -- Name: geometry_inter(geometry, geometry); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometry_inter(geometry, geometry) RETURNS geometry AS '$libdir/libpostgis.so.0.8', 'geometry_inter' LANGUAGE c; -- -- TOC entry 282 (OID 31988) -- Name: geometry_size(geometry, internal); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION geometry_size(geometry, internal) RETURNS real AS '$libdir/libpostgis.so.0.8', 'geometry_size' LANGUAGE c; -- -- TOC entry 394 (OID 31989) -- Name: gist_geometry_ops; Type: OPERATOR CLASS; Schema: public; Owner: postgres -- CREATE OPERATOR CLASS gist_geometry_ops DEFAULT FOR TYPE geometry USING gist AS STORAGE box , OPERATOR 1 <<(geometry,geometry) , OPERATOR 2 &<(geometry,geometry) , OPERATOR 3 &&(geometry,geometry) , OPERATOR 4 &>(geometry,geometry) , OPERATOR 5 >>(geometry,geometry) , OPERATOR 6 ~=(geometry,geometry) , OPERATOR 7 ~(geometry,geometry) , OPERATOR 8 @(geometry,geometry) , FUNCTION 1 ggeometry_consistent(internal,geometry,integer) , FUNCTION 2 gbox_union(bytea,internal) , FUNCTION 3 ggeometry_compress(internal) , FUNCTION 4 rtree_decompress(internal) , FUNCTION 5 gbox_penalty(internal,internal,internal) , FUNCTION 6 gbox_picksplit(internal,internal) , FUNCTION 7 gbox_same(box,box,internal); -- -- TOC entry 395 (OID 31990) -- Name: btree_geometry_ops; Type: OPERATOR CLASS; Schema: public; Owner: postgres -- CREATE OPERATOR CLASS btree_geometry_ops DEFAULT FOR TYPE geometry USING btree AS OPERATOR 1 <(geometry,geometry) , OPERATOR 2 <=(geometry,geometry) , OPERATOR 3 =(geometry,geometry) , OPERATOR 4 >=(geometry,geometry) , OPERATOR 5 >(geometry,geometry) , FUNCTION 1 geometry_cmp(geometry,geometry); -- -- TOC entry 284 (OID 31992) -- Name: addgeometrycolumn(character varying, character varying, character varying, character varying, integer, character varying, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION addgeometrycolumn(character varying, character varying, character varying, character varying, integer, character varying, integer) RETURNS text AS ' DECLARE catalog_name alias for $1; schema_name alias for $2; table_name alias for $3; column_name alias for $4; new_srid alias for $5; new_type alias for $6; new_dim alias for $7; rec RECORD; schema_ok bool; real_schema name; BEGIN IF ( not ( (new_type =''GEOMETRY'') or (new_type =''GEOMETRYCOLLECTION'') or (new_type =''POINT'') or (new_type =''MULTIPOINT'') or (new_type =''POLYGON'') or (new_type =''MULTIPOLYGON'') or (new_type =''LINESTRING'') or (new_type =''MULTILINESTRING'')) ) THEN RAISE EXCEPTION ''Invalid type name - valid ones are: GEOMETRY, GEOMETRYCOLLECTION, POINT, MULTIPOINT, POLYGON, MULTIPOLYGON, LINESTRING, or MULTILINESTRING ''; RETURN ''fail''; END IF; IF ( (new_dim >3) or (new_dim <0) ) THEN RAISE EXCEPTION ''invalid dimension''; RETURN ''fail''; END IF; IF ( schema_name != '''' ) THEN schema_ok = ''f''; FOR rec IN SELECT nspname FROM pg_namespace WHERE text(nspname) = schema_name LOOP schema_ok := ''t''; END LOOP; if ( schema_ok <> ''t'' ) THEN RAISE NOTICE ''Invalid schema name - using current_schema()''; SELECT current_schema() into real_schema; ELSE real_schema = schema_name; END IF; ELSE SELECT current_schema() into real_schema; END IF; EXECUTE ''ALTER TABLE '' || quote_ident(real_schema) || ''.'' || quote_ident(table_name) || '' ADD COLUMN '' || quote_ident(column_name) || '' geometry ''; EXECUTE ''ALTER TABLE '' || quote_ident(real_schema) || ''.'' || quote_ident(table_name) || '' ADD CHECK (SRID('' || quote_ident(column_name) || '') = '' || new_srid || '')'' ; IF (not(new_type = ''GEOMETRY'')) THEN EXECUTE ''ALTER TABLE '' || quote_ident(real_schema) || ''.'' || quote_ident(table_name) || '' ADD CHECK (geometrytype('' || quote_ident(column_name) || '')='' || quote_literal(new_type) || '' OR ('' || quote_ident(column_name) || '') is null)''; END IF; EXECUTE ''INSERT INTO geometry_columns VALUES ('' || quote_literal('''') || '','' || quote_literal(real_schema) || '','' || quote_literal(table_name) || '','' || quote_literal(column_name) || '','' || new_dim || '','' || new_srid || '','' || quote_literal(new_type) || '')''; EXECUTE ''select fix_geometry_columns()''; --SELECT fix_geometry_columns(); return ''Geometry column '' || column_name || '' added to table '' || real_schema || ''.'' || table_name || '' WITH a SRID of '' || new_srid || '' and type '' || new_type; END; ' LANGUAGE plpgsql STRICT; -- -- TOC entry 285 (OID 31993) -- Name: addgeometrycolumn(character varying, character varying, character varying, integer, character varying, integer); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION addgeometrycolumn(character varying, character varying, character varying, integer, character varying, integer) RETURNS text AS ' DECLARE ret text; BEGIN SELECT AddGeometryColumn('''',$1,$2,$3,$4,$5,$6) into ret; RETURN ret; END; ' LANGUAGE plpgsql STRICT; -- -- TOC entry 287 (OID 31994) -- Name: dropgeometrycolumn(character varying, character varying, character varying); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION dropgeometrycolumn(character varying, character varying, character varying) RETURNS text AS ' DECLARE schema_name alias for $1; table_name alias for $2; column_name alias for $3; myrec RECORD; real_schema name; okay boolean; query text; BEGIN -- Find, check or fix schema_name IF ( schema_name != '''' ) THEN okay = ''f''; FOR myrec IN SELECT nspname FROM pg_namespace WHERE text(nspname) = schema_name LOOP okay := ''t''; END LOOP; IF ( okay <> ''t'' ) THEN RAISE NOTICE ''Invalid schema name - using current_schema()''; SELECT current_schema() into real_schema; ELSE real_schema = schema_name; END IF; ELSE SELECT current_schema() into real_schema; END IF; -- first we find out if the column is in the geometry_columns table okay = ''f''; FOR myrec IN SELECT * from geometry_columns where f_table_schema = text(real_schema) and f_table_name = table_name and f_geometry_column = column_name LOOP okay := ''t''; END LOOP; IF (okay <> ''t'') THEN RAISE EXCEPTION ''column not found in geometry_columns table''; RETURN ''f''; END IF; -- Remove ref from geometry_columns table EXECUTE ''delete from geometry_columns where f_table_schema = '' || quote_literal(real_schema) || '' and f_table_name = '' || quote_literal(table_name) || '' and f_geometry_column = '' || quote_literal(column_name); -- Remove table column EXECUTE ''ALTER TABLE '' || quote_ident(real_schema) || ''.'' || quote_ident(table_name) || '' DROP COLUMN '' || quote_ident(column_name); RETURN real_schema || ''.'' || table_name || ''.'' || column_name ||'' effectively removed.''; END; ' LANGUAGE plpgsql STRICT; -- -- TOC entry 288 (OID 31995) -- Name: wind_stage_to_prod(); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION wind_stage_to_prod() RETURNS opaque AS ' begin :new.pk := :new.station_id || "_" || :new.z || "_" || :new.time_stamp; update wind set wind.wind_speed = new.wind_speed, wind_from_direction = new.wind_from_direction where wind.pk = :new.pk; return new; end; ' LANGUAGE plpgsql; -- -- TOC entry 289 (OID 31996) -- Name: check_wind_data(); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION check_wind_data() RETURNS opaque AS ' DECLARE count INTEGER; BEGIN count := get_row_count(new.station_id, new.time_stamp, new.z); IF count = 0 THEN insert into wind(station_id, time_stamp, z, wind_speed, wind_from_direction, the_geom, contact, title, institution, institution_url, institution_dods_url, source, refs) values(new.station_id, new.time_stamp, new.z, new.wind_speed , new.wind_from_direction, new.the_geom, new.contact, new.title, new.institution, new.institution_url, new.institution_dods_url, new.source, new.refs); ELSIF count = 1 THEN update wind set wind_speed = new.wind_speed, wind_from_direction = new.wind_from_direction, the_geom = new.the_geom , contact = new.contact, title = new.title, institution = new.institution, institution_url = new.institution_url, institution_dods_url = new.institution_dods_url, source = new.source, refs = new.refs where station_id = new.station_id and time_stamp = new.time_stamp and z = new.z; ELSE return new; -- should not get here. primary key in wind table prevents duplicates. END IF; return new; END; ' LANGUAGE plpgsql; -- -- TOC entry 290 (OID 31997) -- Name: get_row_count(text, timestamp with time zone, double precision); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION get_row_count(text, timestamp with time zone, double precision) RETURNS integer AS ' DECLARE station_id_param ALIAS FOR $1; time_stamp_param ALIAS FOR $2; z_param ALIAS FOR $3; result INTEGER; BEGIN select into result count(*) from wind where station_id = station_id_param and time_stamp = time_stamp_param and z = z_param; return result; END; ' LANGUAGE plpgsql; -- -- TOC entry 291 (OID 31998) -- Name: run_expressions(); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION run_expressions() RETURNS opaque AS ' DECLARE mysecs INTEGER; my_report_time_stamp timestamp without time zone; BEGIN new.label_char := chr(CAST(1.944 * CAST (new.wind_speed AS INT) AS INT) / 5 + 226); new.label_theta := - (new.wind_from_direction); new.lon := X(new.the_geom); new.lat := Y(new.the_geom); new.secs_from_time_stamp := extract(epoch from new.time_stamp - date_trunc(''hour'',new.time_stamp)); mysecs := extract(epoch from new.time_stamp - date_trunc(''hour'',new.time_stamp)); if (mysecs >= 0 and mysecs <= 15 * 60) THEN new.report_time_stamp := date_trunc(''hour'',new.time_stamp); my_report_time_stamp := date_trunc(''hour'',new.time_stamp); ELSE new.report_time_stamp := date_trunc(''hour'',new.time_stamp) + interval ''1 hour''; my_report_time_stamp := date_trunc(''hour'',new.time_stamp) + interval ''1 hour''; END IF; new.secs_from_report_time_stamp := extract (epoch from new.time_stamp - my_report_time_stamp); insert into wind_changes (station_id, z, report_time_stamp) values (new.station_id, new.z, my_report_time_stamp); return new; END; ' LANGUAGE plpgsql; -- -- TOC entry 292 (OID 31999) -- Name: set_wind_show(); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION set_wind_show() RETURNS character varying AS ' declare first_pass int; unique_obs RECORD; obs_to_refresh RECORD; my_station_id varchar; my_z float; my_report_time_stamp timestamp without time zone; my_time_stamp timestamp without time zone; my_abs_secs_from_report_time_stamp float; num_rec int; show_these_obs varchar; hide_these_obs varchar; num_show int; BEGIN num_show := 0; DROP trigger expression_trig ON wind; first_pass := 1; FOR obs_to_refresh IN select distinct station_id, z, report_time_stamp from wind_changes LOOP FOR unique_obs IN select station_id, z, report_time_stamp, abs(secs_from_report_time_stamp) as abs_secs_from_report_time_stamp, time_stamp from wind where station_id = obs_to_refresh.station_id and z = obs_to_refresh.z and report_time_stamp = obs_to_refresh.report_time_stamp order by station_id, z, report_time_stamp, abs(secs_from_report_time_stamp), time_stamp LOOP IF (first_pass = 1) or (unique_obs.station_id <> my_station_id) THEN first_pass := 0; my_station_id := unique_obs.station_id; my_z := unique_obs.z; my_report_time_stamp := unique_obs.report_time_stamp; num_rec := 0; ELSIF (unique_obs.z <> my_z) THEN my_z := unique_obs.z; my_report_time_stamp := unique_obs.report_time_stamp; num_rec := 0; ELSIF (unique_obs.report_time_stamp <> my_report_time_stamp) THEN my_report_time_stamp := unique_obs.report_time_stamp; num_rec := 0; END IF; IF (num_rec = 0) THEN my_abs_secs_from_report_time_stamp := unique_obs.abs_secs_from_report_time_stamp; my_time_stamp := unique_obs.time_stamp; update wind set show = 1 where wind.station_id = unique_obs.station_id and wind.z = unique_obs.z and wind.time_stamp = my_time_stamp; num_rec := 1; num_show := num_show + 1; ELSE IF (unique_obs.abs_secs_from_report_time_stamp = my_abs_secs_from_report_time_stamp) THEN update wind set show = 0 where wind.station_id = unique_obs.station_id and wind.z = unique_obs.z and wind.time_stamp = my_time_stamp; num_show := num_show + 1; update wind set show = 1 where wind.station_id = unique_obs.station_id and wind.z = unique_obs.z and wind.time_stamp = unique_obs.time_stamp; ELSE update wind set show = 0 where wind.station_id = unique_obs.station_id and wind.z = unique_obs.z and wind.time_stamp = unique_obs.time_stamp; num_show := num_show - 1; END IF; END IF; END LOOP; END LOOP; truncate wind_changes; create trigger expression_trig Before INSERT OR UPDATE ON wind FOR EACH ROW EXECUTE PROCEDURE run_expressions(); return ''SET_WIND_SHOW '' || num_show; END; ' LANGUAGE plpgsql; -- -- TOC entry 293 (OID 32005) -- Name: wind_to_10m(); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION wind_to_10m() RETURNS opaque AS ' DECLARE P FLOAT; z2 INTEGER BEGIN P := 0.11; z2 = 10; new.u2 = new.u1 * ($z2 / new.z1) ** $P; return new; END; ' LANGUAGE plpgsql; -- -- TOC entry 294 (OID 32006) -- Name: do_charlton(); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION do_charlton() RETURNS opaque AS ' begin new.b := new.a; return new; end; ' LANGUAGE plpgsql; -- -- TOC entry 364 (OID 32019) -- Name: set_wind_prod_show(); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION set_wind_prod_show() RETURNS character varying AS ' declare first_pass int; unique_obs RECORD; obs_to_refresh RECORD; my_station_id varchar; my_z float; my_report_time_stamp timestamp without time zone; my_time_stamp timestamp without time zone; my_abs_secs_from_report_time_stamp float; num_rec int; show_these_obs varchar; hide_these_obs varchar; num_show int; BEGIN num_show := 0; DROP trigger wind_labels_and_times_trig ON wind_prod; first_pass := 1; FOR obs_to_refresh IN select distinct station_id, z, report_time_stamp from wind_changes LOOP FOR unique_obs IN select station_id, z, report_time_stamp, abs(secs_from_report_time_stamp) as abs_secs_from_report_time_stamp, time_stamp from wind_prod where station_id = obs_to_refresh.station_id and z = obs_to_refresh.z and report_time_stamp = obs_to_refresh.report_time_stamp order by station_id, z, report_time_stamp, abs(secs_from_report_time_stamp), time_stamp LOOP IF (first_pass = 1) or (unique_obs.station_id <> my_station_id) THEN first_pass := 0; my_station_id := unique_obs.station_id; my_z := unique_obs.z; my_report_time_stamp := unique_obs.report_time_stamp; num_rec := 0; ELSIF (unique_obs.z <> my_z) THEN my_z := unique_obs.z; my_report_time_stamp := unique_obs.report_time_stamp; num_rec := 0; ELSIF (unique_obs.report_time_stamp <> my_report_time_stamp) THEN my_report_time_stamp := unique_obs.report_time_stamp; num_rec := 0; END IF; IF (num_rec = 0) THEN my_abs_secs_from_report_time_stamp := unique_obs.abs_secs_from_report_time_stamp; my_time_stamp := unique_obs.time_stamp; update wind_prod set top_of_hour = 1 where wind_prod.station_id = unique_obs.station_id and wind_prod.time_stamp = my_time_stamp and wind_prod.z = unique_obs.z; num_rec := 1; num_show := num_show + 1; ELSE IF (unique_obs.abs_secs_from_report_time_stamp = my_abs_secs_from_report_time_stamp) THEN update wind_prod set top_of_hour = 0 where wind_prod.station_id = unique_obs.station_id and wind_prod.time_stamp = my_time_stamp and wind_prod.z = unique_obs.z; num_show := num_show + 1; update wind_prod set top_of_hour = 1 where wind_prod.station_id = unique_obs.station_id and wind_prod.time_stamp = unique_obs.time_stamp and wind_prod.z = unique_obs.z; ELSE update wind_prod set top_of_hour = 0 where wind_prod.station_id = unique_obs.station_id and wind_prod.time_stamp = unique_obs.time_stamp and wind_prod.z = unique_obs.z; num_show := num_show - 1; END IF; END IF; END LOOP; END LOOP; truncate wind_changes; create trigger wind_labels_and_times_trig before INSERT OR UPDATE ON wind_prod FOR EACH ROW EXECUTE PROCEDURE wind_labels_and_times(); return ''SET_WIND_PROD_SHOW '' || num_show; END; ' LANGUAGE plpgsql; -- -- TOC entry 283 (OID 32052) -- Name: wind_to_10m(double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION wind_to_10m(double precision, double precision) RETURNS double precision AS ' -- Adjust the wind taken at some height to 10m standard height. -- This uses the algorithm by [Hsu, et al., 1994] which is applicable for -- most atmospheric conditions at sea: -- -- u2 = u1 (z2/z1)P -- -- where u2 is the wind speed at the desired reference height, z2, and u1 is -- the wind speed measured at height z1. A value for the exponent, P, equal to -- 0.11 was empirically determined to be applicable most of the time over the -- ocean. -- -- Hsu, S. A., Eric A. Meindl, and David B. Gilhousen, 1994: Determining the -- Power-Law Wind-Profile Exponent under Near-Neutral Stability Conditions at -- Sea, Applied Meteorology, Vol. 33, No. 6, June 1994. DECLARE u1 ALIAS FOR $1; -- obs wind z1 ALIAS FOR $2; -- obs height P float; -- emperical value for this (good enough for moving ship) z2 int; -- standard ref level BEGIN P := 0.11; z2 := 10; return u1 * (z2 / z1) ^ P; END; ' LANGUAGE plpgsql; -- -- TOC entry 302 (OID 32053) -- Name: hour_date_trunc(); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION hour_date_trunc() RETURNS timestamp with time zone AS ' BEGIN return now(); END; ' LANGUAGE plpgsql; -- -- TOC entry 303 (OID 32054) -- Name: hour_date_trunc(timestamp with time zone); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION hour_date_trunc(timestamp with time zone) RETURNS timestamp with time zone AS ' DECLARE t alias for $1; BEGIN return date_trunc(''hour'',t); END; ' LANGUAGE plpgsql; -- -- TOC entry 95 (OID 400125) -- Name: set_sst_prod_show(); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION set_sst_prod_show() RETURNS character varying AS ' declare first_pass int; unique_obs RECORD; obs_to_refresh RECORD; my_station_id varchar; my_report_time_stamp timestamp without time zone; my_time_stamp timestamp without time zone; my_abs_secs_from_report_time_stamp float; num_rec int; show_these_obs varchar; hide_these_obs varchar; num_show int; BEGIN num_show := 0; DROP trigger sst_labels_and_times_trig ON sst_prod; first_pass := 1; FOR obs_to_refresh IN select distinct station_id, report_time_stamp from sst_changes LOOP FOR unique_obs IN select station_id, report_time_stamp, abs(secs_from_report_time_stamp) as abs_secs_from_report_time_stamp, time_stamp from sst_prod where station_id = obs_to_refresh.station_id and report_time_stamp = obs_to_refresh.report_time_stamp order by station_id, report_time_stamp, abs(secs_from_report_time_stamp), time_stamp LOOP IF (first_pass = 1) or (unique_obs.station_id <> my_station_id) THEN first_pass := 0; my_station_id := unique_obs.station_id; my_report_time_stamp := unique_obs.report_time_stamp; num_rec := 0; ELSIF (unique_obs.report_time_stamp <> my_report_time_stamp) THEN my_report_time_stamp := unique_obs.report_time_stamp; num_rec := 0; END IF; IF (num_rec = 0) THEN my_abs_secs_from_report_time_stamp := unique_obs.abs_secs_from_report_time_stamp; my_time_stamp := unique_obs.time_stamp; update sst_prod set top_of_hour = 1 where sst_prod.station_id = unique_obs.station_id and sst_prod.time_stamp = my_time_stamp; num_rec := 1; num_show := num_show + 1; ELSE IF (unique_obs.abs_secs_from_report_time_stamp = my_abs_secs_from_report_time_stamp) THEN update sst_prod set top_of_hour = 0 where sst_prod.station_id = unique_obs.station_id and sst_prod.time_stamp = my_time_stamp; num_show := num_show + 1; update sst_prod set top_of_hour = 1 where sst_prod.station_id = unique_obs.station_id and sst_prod.time_stamp = unique_obs.time_stamp; ELSE update sst_prod set top_of_hour = 0 where sst_prod.station_id = unique_obs.station_id and sst_prod.time_stamp = unique_obs.time_stamp; num_show := num_show - 1; END IF; END IF; END LOOP; END LOOP; truncate sst_changes; create trigger sst_labels_and_times_trig before INSERT OR UPDATE ON sst_prod FOR EACH ROW EXECUTE PROCEDURE sst_labels_and_times(); return ''SET_sst_PROD_SHOW '' || num_show; END; ' LANGUAGE plpgsql; -- -- TOC entry 18 (OID 42640789) -- Name: in_situ_station_id; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE in_situ_station_id ( station_id character varying NOT NULL, title character varying, institution character varying, institution_url character varying, institution_dods_url character varying, source character varying, refs character varying, contact character varying ); -- -- TOC entry 367 (OID 42751826) -- Name: current_in_situ_formatting(); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION current_in_situ_formatting() RETURNS "trigger" AS ' DECLARE my_speed float; my_theta float; my_label_speed int; mysecs integer; my_report_time_stamp timestamp without time zone; my_label_z float; BEGIN my_speed := round( ( ( (new.eastward_current)^2 + (new.northward_current)^2 )^0.5 )::numeric,4 ); -- The direction FROM, but CW from TN, (dftn) is: -- dftn = 90-df OR: dftn = atan2(-u,-v)*180/pi; -- subtracting 180 makes it TO TN and CW from TN my_theta := atan2(-new.eastward_current, -new.northward_current) * (180.0/pi()) - 180; my_theta := round(my_theta::numeric,2); if (my_theta < 0) then my_theta := my_theta + 360; end if; if (my_theta > 360) then my_theta := my_theta - 360; end if; new.speed := my_speed; new.speed_knots := round((1.944 * my_speed::numeric),2); new.speed_mph := round((2.237 * my_speed::numeric),2); if (new.positive = ''up'') then my_label_z := - (new.z); else my_label_z := new.z; end if; new.label_z := my_label_z; new.theta := my_theta; new.label_theta := -my_theta; if (my_speed > 0) then my_label_speed := (60 * new.speed)::int; if (my_label_speed < 0) then new.label_speed := 0; else new.label_speed := my_label_speed; end if; else new.label_speed := 0; end if; new.label_char := chr(174); new.lon = round(X(new.the_geom)::numeric,2); new.lat = round(Y(new.the_geom)::numeric,2); new.secs_from_time_stamp := extract(epoch from new.time_stamp - date_trunc(''hour'',new.time_stamp)); mysecs := extract(epoch from new.time_stamp - date_trunc(''hour'',new.time_stamp)); if (mysecs >= 0 and mysecs <= 15 * 60) THEN new.report_time_stamp := date_trunc(''hour'',new.time_stamp); my_report_time_stamp := date_trunc(''hour'',new.time_stamp); ELSE new.report_time_stamp := date_trunc(''hour'',new.time_stamp) + interval ''1 hour''; my_report_time_stamp := date_trunc(''hour'',new.time_stamp) + interval ''1 hour''; END IF; new.secs_from_report_time_stamp := extract (epoch from new.time_stamp - my_report_time_stamp); new.value := round(my_speed::numeric,2) || '' m/s'' || '' to the '' || degrees_to_compass(my_theta) || '' ('' || round(my_theta::numeric,2) || '' deg from N)'' || '' @ '' || new.z || ''m''; new.value_knots := round((1.944 * my_speed::numeric),2) || '' knots'' || '' to the '' || degrees_to_compass(my_theta) || '' ('' || round(my_theta::numeric,2) || '' deg from N)'' || '' @ '' || new.z || ''m''; new.value_mph := round((2.237 * my_speed::numeric),2) || '' mph'' || '' to the '' || degrees_to_compass(my_theta) || '' ('' || round(my_theta::numeric,2) || '' deg from N)'' || '' @ '' || new.z || ''m''; new.current_to_direction_compass := degrees_to_compass(my_theta); insert into current_in_situ_changes ( station_id, report_time_stamp, z ) values ( new.station_id, my_report_time_stamp, new.z ); return new; END; ' LANGUAGE plpgsql; -- -- TOC entry 19 (OID 43020832) -- Name: current_stage; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE current_stage ( station_id character varying NOT NULL, time_stamp timestamp without time zone NOT NULL, z double precision, eastward_current double precision, northward_current double precision, title character varying, institution character varying, institution_url character varying, institution_dods_url character varying, source character varying, refs character varying, contact character varying, positive character varying, seq serial NOT NULL, the_geom geometry, CONSTRAINT "$1" CHECK ((srid(the_geom) = -1)), CONSTRAINT "$2" CHECK (((geometrytype(the_geom) = 'POINT'::text) OR (the_geom IS NULL))) ); -- -- TOC entry 20 (OID 48122064) -- Name: grid_current; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE grid_current ( report_time_stamp timestamp without time zone NOT NULL, station_id character varying NOT NULL, title character varying, institution character varying, institution_url character varying, institution_dods_url character varying, source character varying, refs character varying, contact character varying ); -- -- TOC entry 362 (OID 48225207) -- Name: current_formatting(); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION current_formatting() RETURNS "trigger" AS ' DECLARE my_speed float; my_theta float; my_label_speed int; my_label_z float; mysecs integer; BEGIN my_speed := round( ( ( (new.eastward_current)^2 + (new.northward_current)^2 )^0.5 )::numeric,4 ); -- The direction FROM, but CW from TN, (dftn) is: -- dftn = 90-df OR: dftn = atan2(-u,-v)*180/pi; -- subtracting 180 makes it TO TN and CW from TN my_theta := atan2(-new.eastward_current, -new.northward_current) * (180.0/pi()) - 180; my_theta := round(my_theta::numeric,2); if (my_theta < 0) then my_theta := my_theta + 360; end if; if (my_theta > 360) then my_theta := my_theta - 360; end if; new.speed := my_speed; new.speed_knots := round((1.944 * my_speed::numeric),2); new.speed_mph := round((2.237 * my_speed::numeric),2); if (new.positive = ''up'') then my_label_z := - (new.z); else my_label_z := new.z; end if; new.label_z := my_label_z; new.theta := my_theta; new.label_theta := -my_theta; if (my_speed > 0) then my_label_speed := (60 * new.speed)::int; if (my_label_speed < 0) then new.label_speed := 0; else new.label_speed := my_label_speed; end if; else new.label_speed := 0; end if; new.label_char := chr(174); new.lon = round(X(new.the_geom)::numeric,2); new.lat = round(Y(new.the_geom)::numeric,2); -- going to assume that the greatest detail I get for radar currents is hourly mysecs := extract(epoch from new.time_stamp - date_trunc(''hour'',new.time_stamp)); if (mysecs >= 0 and mysecs <= 15 * 60) THEN new.report_time_stamp := date_trunc(''hour'',new.time_stamp); ELSE new.report_time_stamp := date_trunc(''hour'',new.time_stamp) + interval ''1 hour''; END IF; new.value := round(my_speed::numeric,2) || '' m/s'' || '' to the '' || degrees_to_compass(my_theta) || '' ('' || round(my_theta::numeric,2) || '' deg from N)'' || '' @ '' || new.z || ''m''; new.value_knots := round((1.944 * my_speed::numeric),2) || '' knots'' || '' to the '' || degrees_to_compass(my_theta) || '' ('' || round(my_theta::numeric,2) || '' deg from N)'' || '' @ '' || new.z || ''m''; new.value_mph := round((2.237 * my_speed::numeric),2) || '' mph'' || '' to the '' || degrees_to_compass(my_theta) || '' ('' || round(my_theta::numeric,2) || '' deg from N)'' || '' @ '' || new.z || ''m''; return new; END; ' LANGUAGE plpgsql; -- -- TOC entry 371 (OID 48675746) -- Name: set_salinity_prod_show(); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION set_salinity_prod_show() RETURNS character varying AS ' declare first_pass int; unique_obs RECORD; obs_to_refresh RECORD; my_station_id varchar; my_report_time_stamp timestamp without time zone; my_time_stamp timestamp without time zone; my_abs_secs_from_report_time_stamp float; num_rec int; show_these_obs varchar; hide_these_obs varchar; num_show int; BEGIN num_show := 0; DROP trigger salinity_labels_and_times_trig ON salinity_prod; first_pass := 1; FOR obs_to_refresh IN select distinct station_id, report_time_stamp from salinity_changes LOOP FOR unique_obs IN select station_id, report_time_stamp, abs(secs_from_report_time_stamp) as abs_secs_from_report_time_stamp, time_stamp from salinity_prod where station_id = obs_to_refresh.station_id and report_time_stamp = obs_to_refresh.report_time_stamp order by station_id, report_time_stamp, abs(secs_from_report_time_stamp), time_stamp LOOP IF (first_pass = 1) or (unique_obs.station_id <> my_station_id) THEN first_pass := 0; my_station_id := unique_obs.station_id; my_report_time_stamp := unique_obs.report_time_stamp; num_rec := 0; ELSIF (unique_obs.report_time_stamp <> my_report_time_stamp) THEN my_report_time_stamp := unique_obs.report_time_stamp; num_rec := 0; END IF; IF (num_rec = 0) THEN my_abs_secs_from_report_time_stamp := unique_obs.abs_secs_from_report_time_stamp; my_time_stamp := unique_obs.time_stamp; update salinity_prod set top_of_hour = 1 where salinity_prod.station_id = unique_obs.station_id and salinity_prod.time_stamp = my_time_stamp; num_rec := 1; num_show := num_show + 1; ELSE IF (unique_obs.abs_secs_from_report_time_stamp = my_abs_secs_from_report_time_stamp) THEN update salinity_prod set top_of_hour = 0 where salinity_prod.station_id = unique_obs.station_id and salinity_prod.time_stamp = my_time_stamp; num_show := num_show + 1; update salinity_prod set top_of_hour = 1 where salinity_prod.station_id = unique_obs.station_id and salinity_prod.time_stamp = unique_obs.time_stamp; ELSE update salinity_prod set top_of_hour = 0 where salinity_prod.station_id = unique_obs.station_id and salinity_prod.time_stamp = unique_obs.time_stamp; num_show := num_show - 1; END IF; END IF; END LOOP; END LOOP; truncate salinity_changes; create trigger salinity_labels_and_times_trig before INSERT OR UPDATE ON salinity_prod FOR EACH ROW EXECUTE PROCEDURE salinity_labels_and_times(); return ''SET_salinity_PROD_SHOW '' || num_show; END; ' LANGUAGE plpgsql; -- -- TOC entry 21 (OID 51101112) -- Name: current_prod; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE current_prod ( station_id character varying NOT NULL, time_stamp timestamp without time zone NOT NULL, report_time_stamp timestamp without time zone NOT NULL, z double precision, label_z double precision, eastward_current double precision, northward_current double precision, speed double precision, speed_knots double precision, speed_mph double precision, theta double precision, lon double precision, lat double precision, positive character varying, label_theta double precision, label_speed integer, label_char character(1), value character varying, value_knots character varying, value_mph character varying, seq serial NOT NULL, the_geom geometry, CONSTRAINT "$1" CHECK ((srid(the_geom) = -1)), CONSTRAINT "$2" CHECK (((geometrytype(the_geom) = 'POINT'::text) OR (the_geom IS NULL))) ); -- -- TOC entry 368 (OID 52060103) -- Name: set_current_in_situ_prod_show(); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION set_current_in_situ_prod_show() RETURNS character varying AS ' declare first_pass int; unique_obs RECORD; obs_to_refresh RECORD; my_station_id varchar; my_z float; my_report_time_stamp timestamp without time zone; my_time_stamp timestamp without time zone; my_abs_secs_from_report_time_stamp float; num_rec int; show_these_obs varchar; hide_these_obs varchar; num_show int; BEGIN num_show := 0; DROP trigger current_formatting_trig ON current_in_situ_prod; first_pass := 1; FOR obs_to_refresh IN select distinct station_id, z, report_time_stamp from current_in_situ_changes LOOP FOR unique_obs IN select station_id, z, report_time_stamp, abs(secs_from_report_time_stamp) as abs_secs_from_report_time_stamp, time_stamp from current_in_situ_prod where station_id = obs_to_refresh.station_id and z = obs_to_refresh.z and report_time_stamp = obs_to_refresh.report_time_stamp order by station_id, z, report_time_stamp, abs(secs_from_report_time_stamp), time_stamp LOOP IF (first_pass = 1) or (unique_obs.station_id <> my_station_id) THEN first_pass := 0; my_station_id := unique_obs.station_id; my_z := unique_obs.z; my_report_time_stamp := unique_obs.report_time_stamp; num_rec := 0; ELSIF (unique_obs.z <> my_z) THEN my_z := unique_obs.z; my_report_time_stamp := unique_obs.report_time_stamp; num_rec := 0; ELSIF (unique_obs.report_time_stamp <> my_report_time_stamp) THEN my_report_time_stamp := unique_obs.report_time_stamp; num_rec := 0; END IF; IF (num_rec = 0) THEN my_abs_secs_from_report_time_stamp := unique_obs.abs_secs_from_report_time_stamp; my_time_stamp := unique_obs.time_stamp; update current_in_situ_prod set top_of_hour = 1 where current_in_situ_prod.station_id = unique_obs.station_id and current_in_situ_prod.time_stamp = my_time_stamp and current_in_situ_prod.z = unique_obs.z; num_rec := 1; num_show := num_show + 1; ELSE IF (unique_obs.abs_secs_from_report_time_stamp = my_abs_secs_from_report_time_stamp) THEN update current_in_situ_prod set top_of_hour = 0 where current_in_situ_prod.station_id = unique_obs.station_id and current_in_situ_prod.time_stamp = my_time_stamp and current_in_situ_prod.z = unique_obs.z; num_show := num_show + 1; update current_in_situ_prod set top_of_hour = 1 where current_in_situ_prod.station_id = unique_obs.station_id and current_in_situ_prod.time_stamp = unique_obs.time_stamp and current_in_situ_prod.z = unique_obs.z; ELSE update current_in_situ_prod set top_of_hour = 0 where current_in_situ_prod.station_id = unique_obs.station_id and current_in_situ_prod.time_stamp = unique_obs.time_stamp and current_in_situ_prod.z = unique_obs.z; num_show := num_show - 1; END IF; END IF; END LOOP; END LOOP; truncate current_in_situ_changes; create trigger current_formatting_trig before INSERT OR UPDATE ON current_in_situ_prod FOR EACH ROW EXECUTE PROCEDURE current_in_situ_formatting(); return ''SET_current_in_situ_prod_SHOW '' || num_show; END; ' LANGUAGE plpgsql; -- -- TOC entry 366 (OID 59952567) -- Name: salinity_labels_and_times(); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION salinity_labels_and_times() RETURNS "trigger" AS ' DECLARE my_new_time_stamp_char varchar; my_new_time_stamp timestamp with time zone; mysecs INTEGER; my_report_time_stamp timestamp without time zone; my_label_z float; BEGIN -- check to see if incoming time_stamp is > now or < 2 days ago my_new_time_stamp_char := new.time_stamp || ''-00''; my_new_time_stamp := my_new_time_stamp_char; if my_new_time_stamp > now() or my_new_time_stamp < (now() - interval ''2 days'') then raise exception ''% time_stamp is out of bounds'', new.time_stamp; end if; -- we_re going to make all z_s below SS positive -- We could just take the absolute value of z (or in this case negate all vals), -- but this needs to be similar to the other variables; so be consistent. -- Essentially, force z_s to reflect that a positive means down. if (new.positive = ''up'') then my_label_z := - (new.z); -- hope we don_t have SST_s from above SS, though! else my_label_z := new.z; end if; new.label_z := my_label_z; new.lon := round(X(new.the_geom)::numeric,2); new.lat := round(Y(new.the_geom)::numeric,2); new.secs_from_time_stamp := extract(epoch from new.time_stamp - date_trunc(''hour'',new.time_stamp)); mysecs := extract(epoch from new.time_stamp - date_trunc(''hour'',new.time_stamp)); if (mysecs >= 0 and mysecs <= 15 * 60) THEN new.report_time_stamp := date_trunc(''hour'',new.time_stamp); my_report_time_stamp := date_trunc(''hour'',new.time_stamp); ELSE new.report_time_stamp := date_trunc(''hour'',new.time_stamp) + interval ''1 hour''; my_report_time_stamp := date_trunc(''hour'',new.time_stamp) + interval ''1 hour''; END IF; new.secs_from_report_time_stamp := extract (epoch from new.time_stamp - my_report_time_stamp); -- summary column for query results new.value_salinity := round(new.salinity::numeric,2) || '' PPT '' || '' @ '' || my_label_z || ''m''; insert into salinity_changes (station_id, report_time_stamp) values (new.station_id, my_report_time_stamp); return new; END; ' LANGUAGE plpgsql; -- -- TOC entry 22 (OID 243274045) -- Name: quickscat_wind_composite_to_be_backed_up; Type: VIEW; Schema: public; Owner: postgres -- CREATE VIEW quickscat_wind_composite_to_be_backed_up AS SELECT quickscat_wind_composite.station_id, to_char(quickscat_wind_composite.time_stamp, 'YYYY-MM-DD HH24:MI:SS'::text) AS time_stamp_utc, to_char(quickscat_wind_composite.report_time_stamp, 'YYYY-MM-DD HH24:MI:SS'::text) AS pass_time_stamp_utc, quickscat_wind_composite.z, quickscat_wind_composite.positive, quickscat_wind_composite.wind_speed, quickscat_wind_composite.wind_from_direction, quickscat_wind_composite.can_be_normalized, quickscat_wind_composite.lon, quickscat_wind_composite.lat, quickscat_wind_composite.the_geom, quickscat_wind_composite.institution, quickscat_wind_composite.institution_url, quickscat_wind_composite.institution_dods_url, quickscat_wind_composite.source, quickscat_wind_composite.refs, quickscat_wind_composite.contact FROM quickscat_wind_composite WHERE (quickscat_wind_composite.time_stamp < (SELECT (max(quickscat_wind_composite.time_stamp) - '6 days'::interval) FROM quickscat_wind_composite)); -- -- TOC entry 374 (OID 281717065) -- Name: get_top_time_stamp(); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION get_top_time_stamp() RETURNS "trigger" AS ' DECLARE top_time_stamp timestamp with time zone; BEGIN top_time_stamp := timestamp without time zone ''01/01/2000''; if (new.air_pressure_time_stamp > top_time_stamp and new.air_pressure_time_stamp > old.air_pressure_time_stamp) then top_time_stamp := new.air_pressure_time_stamp; end if; if (new.air_temperature_time_stamp > top_time_stamp and new.air_temperature_time_stamp > old.air_temperature_time_stamp) then top_time_stamp := new.air_temperature_time_stamp; end if; if (new.sea_surface_current_speed_and_dir_time_stamp > top_time_stamp and new.sea_surface_current_speed_and_dir_time_stamp > old.sea_surface_current_speed_and_dir_time_stamp) then top_time_stamp := new.sea_surface_current_speed_and_dir_time_stamp; end if; if (new.salinity_time_stamp > top_time_stamp and new.salinity_time_stamp > old.salinity_time_stamp) then top_time_stamp := new.salinity_time_stamp; end if; if (new.water_level_time_stamp > top_time_stamp and new.water_level_time_stamp > old.water_level_time_stamp) then top_time_stamp := new.water_level_time_stamp; end if; if (new.wind_speed_and_dir_time_stamp > top_time_stamp and new.wind_speed_and_dir_time_stamp > old.wind_speed_and_dir_time_stamp) then top_time_stamp := new.wind_speed_and_dir_time_stamp; end if; if (new.wind_gust_time_stamp > top_time_stamp and new.wind_gust_time_stamp > old.wind_gust_time_stamp) then top_time_stamp := new.wind_gust_time_stamp; end if; if (new.normalized_wind_speed_and_dir_time_stamp > top_time_stamp and new.normalized_wind_speed_and_dir_time_stamp > old.normalized_wind_speed_and_dir_time_stamp) then top_time_stamp := new.normalized_wind_speed_and_dir_time_stamp; end if; if (new.normalized_wind_gust_time_stamp > top_time_stamp and new.normalized_wind_gust_time_stamp > old.normalized_wind_gust_time_stamp) then top_time_stamp := new.normalized_wind_gust_time_stamp; end if; if (new.sea_surface_temperature_time_stamp > top_time_stamp and new.sea_surface_temperature_time_stamp > old.sea_surface_temperature_time_stamp) then top_time_stamp := new.sea_surface_temperature_time_stamp; end if; if (new.significant_wave_height_time_stamp > top_time_stamp and new.significant_wave_height_time_stamp > old.significant_wave_height_time_stamp) then top_time_stamp := new.significant_wave_height_time_stamp; end if; if (new.dominant_wave_period_time_stamp > top_time_stamp and new.dominant_wave_period_time_stamp > old.dominant_wave_period_time_stamp) then top_time_stamp := new.dominant_wave_period_time_stamp; end if; if (top_time_stamp is null) then top_time_stamp := new.report_time_stamp; end if; new.top_time_stamp := top_time_stamp; return new; END; ' LANGUAGE plpgsql; -- -- TOC entry 297 (OID 299186536) -- Name: get_top_time_stamp_update(); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION get_top_time_stamp_update() RETURNS "trigger" AS ' DECLARE top_time_stamp timestamp without time zone; BEGIN top_time_stamp := old.top_time_stamp; if (new.air_pressure_time_stamp > top_time_stamp) then top_time_stamp := new.air_pressure_time_stamp; end if; if (new.air_temperature_time_stamp > top_time_stamp) then top_time_stamp := new.air_temperature_time_stamp; end if; if (new.sea_surface_current_speed_and_dir_time_stamp > top_time_stamp) then top_time_stamp := new.sea_surface_current_speed_and_dir_time_stamp; end if; if (new.salinity_time_stamp > top_time_stamp) then top_time_stamp := new.salinity_time_stamp; end if; if (new.water_level_time_stamp > top_time_stamp) then top_time_stamp := new.water_level_time_stamp; end if; if (new.wind_speed_and_dir_time_stamp > top_time_stamp) then top_time_stamp := new.wind_speed_and_dir_time_stamp; end if; if (new.wind_gust_time_stamp > top_time_stamp) then top_time_stamp := new.wind_gust_time_stamp; end if; if (new.normalized_wind_speed_and_dir_time_stamp > top_time_stamp) then top_time_stamp := new.normalized_wind_speed_and_dir_time_stamp; end if; if (new.normalized_wind_gust_time_stamp > top_time_stamp) then top_time_stamp := new.normalized_wind_gust_time_stamp; end if; if (new.sea_surface_temperature_time_stamp > top_time_stamp) then top_time_stamp := new.sea_surface_temperature_time_stamp; end if; if (new.significant_wave_height_time_stamp > top_time_stamp) then top_time_stamp := new.significant_wave_height_time_stamp; end if; if (new.dominant_wave_period_time_stamp > top_time_stamp) then top_time_stamp := new.dominant_wave_period_time_stamp; end if; new.top_time_stamp := top_time_stamp; return new; END; ' LANGUAGE plpgsql; -- -- TOC entry 301 (OID 299186537) -- Name: get_top_time_stamp_insert(); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION get_top_time_stamp_insert() RETURNS "trigger" AS ' DECLARE top_time_stamp timestamp without time zone; BEGIN if (new.air_pressure_time_stamp > top_time_stamp and new.air_pressure_time_stamp is not null) then top_time_stamp := new.air_pressure_time_stamp; end if; if (new.air_temperature_time_stamp > top_time_stamp and new.air_temperature_time_stamp is not null) then top_time_stamp := new.air_temperature_time_stamp; end if; if (new.sea_surface_current_speed_and_dir_time_stamp > top_time_stamp and new.sea_surface_current_speed_and_dir_time_stamp is not null) then top_time_stamp := new.sea_surface_current_speed_and_dir_time_stamp; end if; if (new.salinity_time_stamp > top_time_stamp and new.salinity_time_stamp is not null) then top_time_stamp := new.salinity_time_stamp; end if; if (new.water_level_time_stamp > top_time_stamp and new.water_level_time_stamp is not null) then top_time_stamp := new.water_level_time_stamp; end if; if (new.wind_speed_and_dir_time_stamp > top_time_stamp and new.wind_speed_and_dir_time_stamp is not null) then top_time_stamp := new.wind_speed_and_dir_time_stamp; end if; if (new.wind_gust_time_stamp > top_time_stamp and new.wind_gust_time_stamp is not null) then top_time_stamp := new.wind_gust_time_stamp; end if; if (new.normalized_wind_speed_and_dir_time_stamp > top_time_stamp and new.normalized_wind_speed_and_dir_time_stamp is not null) then top_time_stamp := new.normalized_wind_speed_and_dir_time_stamp; end if; if (new.normalized_wind_gust_time_stamp > top_time_stamp and new.normalized_wind_gust_time_stamp is not null) then top_time_stamp := new.normalized_wind_gust_time_stamp; end if; if (new.sea_surface_temperature_time_stamp > top_time_stamp and new.sea_surface_temperature_time_stamp is not null) then top_time_stamp := new.sea_surface_temperature_time_stamp; end if; if (new.significant_wave_height_time_stamp > top_time_stamp and new.significant_wave_height_time_stamp is not null) then top_time_stamp := new.significant_wave_height_time_stamp; end if; if (new.dominant_wave_period_time_stamp > top_time_stamp and new.dominant_wave_period_time_stamp is not null) then top_time_stamp := new.dominant_wave_period_time_stamp; end if; if (top_time_stamp is null) then top_time_stamp := new.report_time_stamp; end if; new.top_time_stamp := top_time_stamp; return new; END; ' LANGUAGE plpgsql; -- -- TOC entry 363 (OID 360190244) -- Name: wind_10m_to_z(timestamp without time zone); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION wind_10m_to_z(timestamp without time zone) RETURNS timestamp without time zone AS ' DECLARE ts ALIAS FOR $1; mysecs integer; BEGIN -- going to assume that the greatest detail I get for radar currents is hourly mysecs := extract(epoch from ts - date_trunc(''hour'',ts)); if (mysecs >= 0 and mysecs <= 15 * 60) THEN return date_trunc(''hour'',ts); ELSE return date_trunc(''hour'',ts) + interval ''1 hour''; END IF; END; ' LANGUAGE plpgsql; -- -- TOC entry 286 (OID 360221790) -- Name: wind_10m_to_z(double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION wind_10m_to_z(double precision, double precision) RETURNS double precision AS ' -- Reverse of wind_to_10m DECLARE u2 ALIAS FOR $1; -- obs normalized wind z1 ALIAS FOR $2; -- obs height P float; -- emperical value for this (good enough for moving ship) z2 int; -- standard ref level BEGIN P := 0.11; z2 := 10; return u2 / ( (z2/z1) ^ P); END; ' LANGUAGE plpgsql; -- -- TOC entry 365 (OID 360278248) -- Name: ts_to_top_of_hour(timestamp without time zone); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION ts_to_top_of_hour(timestamp without time zone) RETURNS timestamp without time zone AS ' DECLARE ts ALIAS FOR $1; mysecs integer; BEGIN -- going to assume that the greatest detail I get for radar currents is hourly mysecs := extract(epoch from ts - date_trunc(''hour'',ts)); if (mysecs >= 0 and mysecs <= 15 * 60) THEN return date_trunc(''hour'',ts); ELSE return date_trunc(''hour'',ts) + interval ''1 hour''; END IF; END; ' LANGUAGE plpgsql; -- -- TOC entry 369 (OID 364282130) -- Name: water_level_labels_and_times(); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION water_level_labels_and_times() RETURNS "trigger" AS ' DECLARE my_new_time_stamp_char varchar; my_new_time_stamp timestamp with time zone; mysecs INTEGER; my_report_time_stamp timestamp without time zone; my_label_z float; my_water_level_mllw float; my_water_level_msl float; my_water_level_navd88 float; my_water_level_mllw_ft float; my_water_level_msl_ft float; my_water_level_navd88_ft float; BEGIN -- check to see if incoming time_stamp is > now or < 2 days ago my_new_time_stamp_char := new.time_stamp || ''-00''; my_new_time_stamp := my_new_time_stamp_char; if my_new_time_stamp > now() or my_new_time_stamp < (now() - interval ''2 days'') then raise exception ''% time_stamp is out of bounds'', new.time_stamp; end if; if new.reference = ''MLLW'' then my_water_level_mllw := new.water_level; my_water_level_msl := new.water_level - new.reference_to_msl; my_water_level_navd88 := new.water_level - new.reference_to_navd88; elsif new.reference = ''MSL'' then my_water_level_msl := new.water_level; my_water_level_mllw := new.water_level - new.reference_to_mllw; my_water_level_navd88 := new.water_level - new.reference_to_navd88; elsif new.reference = ''NAVD88'' then my_water_level_navd88 := new.water_level; my_water_level_msl := new.water_level - new.reference_to_msl; my_water_level_mllw := new.water_level - new.reference_to_mllw; else raise exception ''% reference is unknown'', new.reference; end if; new.water_level_mllw := round(my_water_level_mllw::numeric,2); new.water_level_msl := round(my_water_level_msl::numeric,2); new.water_level_navd88 := round(my_water_level_navd88::numeric,2); my_water_level_mllw_ft := my_water_level_mllw * 3.2808399; my_water_level_mllw_ft := round(my_water_level_mllw_ft::numeric,2); new.water_level_mllw_ft := my_water_level_mllw_ft::numeric; my_water_level_msl_ft := my_water_level_msl * 3.2808399; my_water_level_msl_ft := round(my_water_level_msl_ft::numeric,2); new.water_level_msl_ft := my_water_level_msl_ft::numeric; my_water_level_navd88_ft := my_water_level_navd88 * 3.2808399; my_water_level_navd88_ft := round(my_water_level_navd88_ft::numeric,2); new.water_level_navd88_ft := my_water_level_navd88_ft::numeric; -- Essentially, force z_s to reflect that a positive means down. if (new.positive = ''up'') then my_label_z := - (new.z); -- hope we don_t have SST_s from above SS, though! else my_label_z := new.z; end if; new.label_z := my_label_z; new.lon := round(X(new.the_geom)::numeric,2); new.lat := round(Y(new.the_geom)::numeric,2); new.secs_from_time_stamp := extract(epoch from new.time_stamp - date_trunc(''hour'',new.time_stamp)); mysecs := extract(epoch from new.time_stamp - date_trunc(''hour'',new.time_stamp)); if (mysecs >= 0 and mysecs <= 15 * 60) THEN new.report_time_stamp := date_trunc(''hour'',new.time_stamp); my_report_time_stamp := date_trunc(''hour'',new.time_stamp); ELSE new.report_time_stamp := date_trunc(''hour'',new.time_stamp) + interval ''1 hour''; my_report_time_stamp := date_trunc(''hour'',new.time_stamp) + interval ''1 hour''; END IF; new.secs_from_report_time_stamp := extract (epoch from new.time_stamp - my_report_time_stamp); -- summary column for query results new.value_water_level_mllw := round(my_water_level_mllw::numeric,2) || '' m (MLLW)''; new.value_water_level_msl := round(my_water_level_msl::numeric,2) || '' m (MSL)''; new.value_water_level_navd88 := round(my_water_level_navd88::numeric,2) || '' m (NAVD88)''; new.value_ft_water_level_mllw := round(my_water_level_mllw_ft::numeric,2) || '' ft (MLLW)''; new.value_ft_water_level_msl := round(my_water_level_msl_ft::numeric,2) || '' ft (MSL)''; new.value_ft_water_level_navd88 := round(my_water_level_msl_ft::numeric,2) || '' ft (NAVD88)''; insert into water_level_changes (station_id, report_time_stamp) values (new.station_id, my_report_time_stamp); return new; END; ' LANGUAGE plpgsql; -- -- TOC entry 359 (OID 368187653) -- Name: wave_in_situ_formatting(); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION wave_in_situ_formatting() RETURNS "trigger" AS ' DECLARE my_height_ft float; my_period float; mysecs integer; my_report_time_stamp timestamp without time zone; my_label_z float; BEGIN new.significant_wave_height := round(new.significant_wave_height::numeric,2); new.significant_wave_height_ft := round((new.significant_wave_height * 3.2808399)::numeric,2); new.dominant_wave_period := round(new.dominant_wave_period::numeric,2); if (new.positive = ''up'') then my_label_z := - (new.z); else my_label_z := new.z; end if; new.label_z := my_label_z; new.lon = round(X(new.the_geom)::numeric,2); new.lat = round(Y(new.the_geom)::numeric,2); new.secs_from_time_stamp := extract(epoch from new.time_stamp - date_trunc(''hour'',new.time_stamp)); mysecs := extract(epoch from new.time_stamp - date_trunc(''hour'',new.time_stamp)); if (mysecs >= 0 and mysecs <= 15 * 60) THEN new.report_time_stamp := date_trunc(''hour'',new.time_stamp); my_report_time_stamp := date_trunc(''hour'',new.time_stamp); ELSE new.report_time_stamp := date_trunc(''hour'',new.time_stamp) + interval ''1 hour''; my_report_time_stamp := date_trunc(''hour'',new.time_stamp) + interval ''1 hour''; END IF; new.secs_from_report_time_stamp := extract (epoch from new.time_stamp - my_report_time_stamp); new.value_significant_wave_height := round(new.significant_wave_height::numeric,2) || '' m'' || '' @ '' || new.z || ''m''; new.value_ft_significant_wave_height := round((new.significant_wave_height * 3.2808399)::numeric,2) || '' ft'' || '' @ '' || new.z || ''m''; new.value_dominant_wave_period := round(new.dominant_wave_period::numeric,2) || '' s'' || '' @ '' || new.z || ''m''; insert into wave_in_situ_changes ( station_id, report_time_stamp, z ) values ( new.station_id, my_report_time_stamp, new.z ); return new; END; ' LANGUAGE plpgsql; -- -- TOC entry 360 (OID 368187753) -- Name: set_wave_in_situ_prod_show(); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION set_wave_in_situ_prod_show() RETURNS character varying AS ' declare first_pass int; unique_obs RECORD; obs_to_refresh RECORD; my_station_id varchar; my_z float; my_report_time_stamp timestamp without time zone; my_time_stamp timestamp without time zone; my_abs_secs_from_report_time_stamp float; num_rec int; show_these_obs varchar; hide_these_obs varchar; num_show int; BEGIN num_show := 0; DROP trigger wave_formatting_trig ON wave_in_situ_prod; first_pass := 1; FOR obs_to_refresh IN select distinct station_id, z, report_time_stamp from wave_in_situ_changes LOOP FOR unique_obs IN select station_id, z, report_time_stamp, abs(secs_from_report_time_stamp) as abs_secs_from_report_time_stamp, time_stamp from wave_in_situ_prod where station_id = obs_to_refresh.station_id and z = obs_to_refresh.z and report_time_stamp = obs_to_refresh.report_time_stamp order by station_id, z, report_time_stamp, abs(secs_from_report_time_stamp), time_stamp LOOP IF (first_pass = 1) or (unique_obs.station_id <> my_station_id) THEN first_pass := 0; my_station_id := unique_obs.station_id; my_z := unique_obs.z; my_report_time_stamp := unique_obs.report_time_stamp; num_rec := 0; ELSIF (unique_obs.z <> my_z) THEN my_z := unique_obs.z; my_report_time_stamp := unique_obs.report_time_stamp; num_rec := 0; ELSIF (unique_obs.report_time_stamp <> my_report_time_stamp) THEN my_report_time_stamp := unique_obs.report_time_stamp; num_rec := 0; END IF; IF (num_rec = 0) THEN my_abs_secs_from_report_time_stamp := unique_obs.abs_secs_from_report_time_stamp; my_time_stamp := unique_obs.time_stamp; update wave_in_situ_prod set top_of_hour = 1 where wave_in_situ_prod.station_id = unique_obs.station_id and wave_in_situ_prod.time_stamp = my_time_stamp and wave_in_situ_prod.z = unique_obs.z; num_rec := 1; num_show := num_show + 1; ELSE IF (unique_obs.abs_secs_from_report_time_stamp = my_abs_secs_from_report_time_stamp) THEN update wave_in_situ_prod set top_of_hour = 0 where wave_in_situ_prod.station_id = unique_obs.station_id and wave_in_situ_prod.time_stamp = my_time_stamp and wave_in_situ_prod.z = unique_obs.z; num_show := num_show + 1; update wave_in_situ_prod set top_of_hour = 1 where wave_in_situ_prod.station_id = unique_obs.station_id and wave_in_situ_prod.time_stamp = unique_obs.time_stamp and wave_in_situ_prod.z = unique_obs.z; ELSE update wave_in_situ_prod set top_of_hour = 0 where wave_in_situ_prod.station_id = unique_obs.station_id and wave_in_situ_prod.time_stamp = unique_obs.time_stamp and wave_in_situ_prod.z = unique_obs.z; num_show := num_show - 1; END IF; END IF; END LOOP; END LOOP; truncate wave_in_situ_changes; create trigger wave_formatting_trig before INSERT OR UPDATE ON wave_in_situ_prod FOR EACH ROW EXECUTE PROCEDURE wave_in_situ_formatting(); return ''SET_wave_in_situ_prod_SHOW '' || num_show; END; ' LANGUAGE plpgsql; -- -- TOC entry 306 (OID 388181597) -- Name: set_wind_grid_report_time_stamp(); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION set_wind_grid_report_time_stamp() RETURNS integer AS ' BEGIN -- average the min and max time_stamps w/i each orbit update wind_grid_stage set report_time_stamp = ( select timestamp without time zone ''1970-01-01 00:00:00'' + (min(extract(epoch from time_stamp)) + max(extract(epoch from time_stamp))) / 2 * interval ''1 second'' as report_time_stamp from wind_grid_stage a where a.orbit = wind_grid_stage.orbit group by orbit ); return 0; END; ' LANGUAGE plpgsql; -- -- TOC entry 305 (OID 388264783) -- Name: wind_grid_labels_and_times(); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION wind_grid_labels_and_times() RETURNS "trigger" AS ' DECLARE my_new_time_stamp_char varchar; my_new_time_stamp timestamp with time zone; mysecs integer; my_report_time_stamp timestamp without time zone; my_normalized_wind_speed float; BEGIN -- check to see if incoming time_stamp is > now or < 2 days ago -- COMMENTED OUT FOR NOW -- my_new_time_stamp_char := new.time_stamp || ''-00''; -- my_new_time_stamp := my_new_time_stamp_char; -- if my_new_time_stamp > now() or my_new_time_stamp < (now() - interval ''2 days'') then -- raise exception ''% time_stamp is out of bounds'', new.time_stamp; -- end if; -- for winds, we_re going to make all z_s above SS positive and below negative -- Essentially, force z_s to reflect that a positive means up. if (new.positive = ''down'') then new.label_z := - (new.z); else new.label_z := new.z; end if; -- normalize the speed if (new.can_be_normalized = ''yes'') then my_normalized_wind_speed := wind_to_10m(new.wind_speed,new.z); else my_normalized_wind_speed := new.wind_speed; end if; new.normalized_wind_speed := my_normalized_wind_speed; -- make the MapServer layer stuff new.label_char := chr(cast(mod(cast(trunc(1.944 * new.wind_speed / 5 -.5) as numeric), 28) + 227 as int)); new.normalized_label_char := chr(cast(mod(cast(trunc(1.944 * my_normalized_wind_speed / 5 -.5) as numeric), 28) + 227 as int)); new.wind_speed_knots := 1.944 * new.wind_speed; new.normalized_wind_speed_knots := 1.944 * my_normalized_wind_speed; new.label_theta := - (new.wind_from_direction); new.lon := X(new.the_geom); new.lat := Y(new.the_geom); return new; END; ' LANGUAGE plpgsql; -- -- TOC entry 372 (OID 605104554) -- Name: air_pressure_labels_and_times(); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION air_pressure_labels_and_times() RETURNS "trigger" AS ' DECLARE my_new_time_stamp_char varchar; my_new_time_stamp timestamp with time zone; mysecs INTEGER; my_report_time_stamp timestamp without time zone; my_label_z float; BEGIN -- check to see if incoming time_stamp is > now or < 2 days ago my_new_time_stamp_char := new.time_stamp || ''-00''; my_new_time_stamp := my_new_time_stamp_char; if my_new_time_stamp > now() or my_new_time_stamp < (now() - interval ''2 days'') then raise exception ''% time_stamp is out of bounds'', new.time_stamp; end if; new.pressure_inches_mercury = round((new.pressure * 0.02953)::numeric,2); -- for air_pressure, we_re going to make all z_s above SS positive -- We could just take the absolute value of z (or in this case negate all vals), -- but this needs to be similar to the other variables; so be consistent. -- Essentially, force z_s to reflect that a positive means up. if (new.positive = ''up'') then my_label_z := new.z; -- hope we don_t have air_pressure_s from below SS, though! else my_label_z := - (new.z); end if; new.label_z := my_label_z; new.lon := round(X(new.the_geom)::numeric,2); new.lat := round(Y(new.the_geom)::numeric,2); new.secs_from_time_stamp := extract(epoch from new.time_stamp - date_trunc(''hour'',new.time_stamp)); mysecs := extract(epoch from new.time_stamp - date_trunc(''hour'',new.time_stamp)); if (mysecs >= 0 and mysecs <= 15 * 60) THEN new.report_time_stamp := date_trunc(''hour'',new.time_stamp); my_report_time_stamp := date_trunc(''hour'',new.time_stamp); ELSE new.report_time_stamp := date_trunc(''hour'',new.time_stamp) + interval ''1 hour''; my_report_time_stamp := date_trunc(''hour'',new.time_stamp) + interval ''1 hour''; END IF; new.secs_from_report_time_stamp := extract (epoch from new.time_stamp - my_report_time_stamp); -- summary column for query results new.value_pressure := round(new.pressure::numeric,2) || '' mb '' || '' @ '' || my_label_z || ''m''; new.value_pressure_inches_mercury := round((new.pressure * 0.02953)::numeric,2) || '' in Hg (0 deg C) '' || '' @ '' || my_label_z || ''m''; insert into air_pressure_changes (station_id, report_time_stamp) values (new.station_id, my_report_time_stamp); return new; END; ' LANGUAGE plpgsql; -- -- TOC entry 342 (OID 713341088) -- Name: degrees_to_compass(double precision); Type: FUNCTION; Schema: public; Owner: postgres -- CREATE FUNCTION degrees_to_compass(double precision) RETURNS character varying AS ' -- Thanks to Eric Bridger of GoMOOS. -- This the library routine we have used for a long time. Works well. -- It also works for negative degrees. -- This assumes 0 and 360 are north, with degrees going clockwise, -- i.e. 90 degrees is West, 180 South, etc. DECLARE degrees ALIAS FOR $1; this_degrees float; quad float; compass varchar[]; BEGIN if (degrees > 360 or degrees < -360) then return ''''; end if; compass = ARRAY[''N'', ''NNE'', ''NE'', ''ENE'', ''E'', ''ESE'', ''SE'', ''SSE'', ''S'', ''SSW'', ''SW'', ''WSW'', ''W'', ''WNW'', ''NW'', ''NNW'']; this_degrees := (degrees + 22.5) / 22.5; this_degrees := this_degrees - 0.5; quad := this_degrees::int % 16 + 1; -- pgsql has 1-based arrays! return (compass[quad]); END;