/*
PGSQL Data Transfer
Source Host: localhost
Source Database: dblunigiana
Target Host: localhost
Target Database: dblunigiana
Date: 2/11/2009 5:29:18 PM
*/


-- ----------------------------
-- Table structure for "elenchi"."e_azione"
-- ----------------------------
drop table "elenchi"."e_azione";
CREATE TABLE "elenchi"."e_azione"(
"id" int4 NOT NULL DEFAULT nextval('e_azione_id_seq'::regclass),
"azione" varchar NOT NULL ,
PRIMARY KEY ("id"),
UNIQUE ("azione") 
)  WITHOUT OIDS;

-- ----------------------------
-- Table structure for "elenchi"."e_categoria_oggetto"
-- ----------------------------
drop table "elenchi"."e_categoria_oggetto";
CREATE TABLE "elenchi"."e_categoria_oggetto"(
"id" int4 NOT NULL DEFAULT nextval('e_categoria_oggetto_id_seq'::regclass),
"cat_ogg" varchar NOT NULL ,
PRIMARY KEY ("id")
)  WITHOUT OIDS;
COMMENT ON TABLE "elenchi"."e_categoria_oggetto" IS 'elenco delle categorie dell''oggetto';

-- ----------------------------
-- Table structure for "elenchi"."e_posizione"
-- ----------------------------
drop table "elenchi"."e_posizione";
CREATE TABLE "elenchi"."e_posizione"(
"id" int4 NOT NULL DEFAULT nextval('e_posizione_id_seq'::regclass),
"posizione" varchar NOT NULL ,
PRIMARY KEY ("id"),
UNIQUE ("posizione") 
)  WITHOUT OIDS;
COMMENT ON TABLE "elenchi"."e_posizione" IS 'posizione di un oggetto rispetto a un toponimo';

-- ----------------------------
-- Table structure for "elenchi"."e_tipo_oggetto"
-- ----------------------------
drop table "elenchi"."e_tipo_oggetto";
CREATE TABLE "elenchi"."e_tipo_oggetto"(
"id" int4 NOT NULL DEFAULT nextval('e_tipo_oggetto_id_seq1'::regclass),
"tipo_ogg" varchar NOT NULL ,
"cat_ogg" varchar ,
PRIMARY KEY ("id")
)  WITHOUT OIDS;
COMMENT ON TABLE "elenchi"."e_tipo_oggetto" IS 'elenco tipologie oggetto';

-- ----------------------------
-- Table structure for "elenchi"."e_tipo_proprieta"
-- ----------------------------
drop table "elenchi"."e_tipo_proprieta";
CREATE TABLE "elenchi"."e_tipo_proprieta"(
"id" int4 NOT NULL DEFAULT nextval('e_tipo_proprieta_id_seq'::regclass),
"tipo_proprieta" varchar NOT NULL ,
PRIMARY KEY ("id"),
UNIQUE ("tipo_proprieta") 
)  WITHOUT OIDS;

-- ----------------------------
-- Table structure for "public"."geometry_columns"
-- ----------------------------
drop table "public"."geometry_columns";
CREATE TABLE "public"."geometry_columns"(
"f_table_catalog" varchar(256) NOT NULL ,
"f_table_schema" varchar(256) NOT NULL ,
"f_table_name" varchar(256) NOT NULL ,
"f_geometry_column" varchar(256) NOT NULL ,
"coord_dimension" int4 NOT NULL ,
"srid" int4 NOT NULL ,
"type" varchar(30) NOT NULL ,
PRIMARY KEY ("f_table_catalog", "f_table_schema", "f_table_name", "f_geometry_column")
)  WITH OIDS;

-- ----------------------------
-- Table structure for "public"."spatial_ref_sys"
-- ----------------------------
drop table "public"."spatial_ref_sys";
CREATE TABLE "public"."spatial_ref_sys"(
"srid" int4 NOT NULL ,
"auth_name" varchar(256) ,
"auth_srid" int4 ,
"srtext" varchar(2048) ,
"proj4text" varchar(2048) ,
PRIMARY KEY ("srid")
)  WITHOUT OIDS;

-- ----------------------------
-- Table structure for "public"."t_documenti"
-- ----------------------------
drop table "public"."t_documenti";
CREATE TABLE "public"."t_documenti"(
"id_doc" int4 NOT NULL DEFAULT nextval('t_documenti_id_doc_seq1'::regclass),
"nome_doc" varchar(255) ,
"luogo" varchar(255) ,
"regesto" varchar(255) ,
"data_da_a" _date ,
"pagine" varchar ,
"brani" text ,
"doc_integrale" text ,
"edizione" varchar ,
"biblio" varchar ,
"note" text ,
"data_ins" date ,
"utente_ins" int4 ,
PRIMARY KEY ("id_doc")
)  WITHOUT OIDS;

-- ----------------------------
-- Table structure for "public"."t_eventi"
-- ----------------------------
drop table "public"."t_eventi";
CREATE TABLE "public"."t_eventi"(
"id_eve" int4 NOT NULL DEFAULT nextval('t_eventi_id_eve_seq1'::regclass),
"id_doc" int4 ,
"id_ogg" int4 ,
"id_sog" int4 ,
"trascr_sog" varchar ,
"id_ist" int4 ,
"azione" varchar(10) ,
"tipo_proprieta" varchar ,
"prop_condivisa" bool ,
"data_da_a" _date ,
"note" text ,
"data_ins" date ,
"utente_ins" int4 ,
PRIMARY KEY ("id_eve"),
FOREIGN KEY ("id_ogg") REFERENCES "public"."t_oggetti"("id_ogg") ON UPDATE NO ACTION ON DELETE NO ACTION ,
FOREIGN KEY ("id_sog") REFERENCES "public"."t_soggetti"("id_sog") ON UPDATE NO ACTION ON DELETE NO ACTION ,
FOREIGN KEY ("id_doc") REFERENCES "public"."t_documenti"("id_doc") ON UPDATE NO ACTION ON DELETE NO ACTION ,
FOREIGN KEY ("utente_ins") REFERENCES "public"."t_utenti"("cod_utente") ON UPDATE NO ACTION ON DELETE NO ACTION ,
FOREIGN KEY ("id_ist") REFERENCES "public"."t_istituzioni"("id_ist") ON UPDATE NO ACTION ON DELETE NO ACTION 
)  WITHOUT OIDS;

CREATE INDEX "fki_" ON "public"."t_eventi" USING btree ("id_ist");

CREATE INDEX "fki_ogg" ON "public"."t_eventi" USING btree ("id_ogg");

CREATE INDEX "fki_sog" ON "public"."t_eventi" USING btree ("id_sog");

CREATE INDEX "fki_doc" ON "public"."t_eventi" USING btree ("id_doc");

CREATE INDEX "fki_ute" ON "public"."t_eventi" USING btree ("utente_ins");

-- ----------------------------
-- Table structure for "public"."t_istituzioni"
-- ----------------------------
drop table "public"."t_istituzioni";
CREATE TABLE "public"."t_istituzioni"(
"id_ist" int4 NOT NULL DEFAULT nextval('t_istituzioni_id_ist_seq'::regclass),
"nome_ist" varchar ,
"note" text ,
"data_ins" date ,
"utente_ins" int4 ,
PRIMARY KEY ("id_ist")
)  WITHOUT OIDS;

-- ----------------------------
-- Table structure for "public"."t_oggetti"
-- ----------------------------
drop table "public"."t_oggetti";
CREATE TABLE "public"."t_oggetti"(
"id_ogg" int4 NOT NULL DEFAULT nextval('t_oggetti_id_ogg_seq'::regclass),
"nome_ogg" varchar ,
"descr_ogg" varchar NOT NULL ,
"cat_ogg" varchar NOT NULL ,
"tipo_ogg" varchar ,
"note" text ,
"data_ins" date ,
"utente_ins" date ,
PRIMARY KEY ("id_ogg")
)  WITHOUT OIDS;

-- ----------------------------
-- Table structure for "public"."t_prossimita"
-- ----------------------------
drop table "public"."t_prossimita";
CREATE TABLE "public"."t_prossimita"(
"id_prs" int4 NOT NULL DEFAULT nextval('t_prossimita_id_prs_seq'::regclass),
"id_ogg" int4 NOT NULL ,
"id_top" int4 NOT NULL ,
"posizione" varchar NOT NULL ,
"id_doc" int4 ,
PRIMARY KEY ("id_prs"),
FOREIGN KEY ("id_top") REFERENCES "public"."t_toponimi"("id_top") ON UPDATE NO ACTION ON DELETE NO ACTION ,
FOREIGN KEY ("id_ogg") REFERENCES "public"."t_oggetti"("id_ogg") ON UPDATE NO ACTION ON DELETE NO ACTION 
)  WITHOUT OIDS;

CREATE INDEX "fki_top" ON "public"."t_prossimita" USING btree ("id_top");

CREATE INDEX "fki_ogg_prs" ON "public"."t_prossimita" USING btree ("id_ogg");

-- ----------------------------
-- Table structure for "public"."t_soggetti"
-- ----------------------------
drop table "public"."t_soggetti";
CREATE TABLE "public"."t_soggetti"(
"id_sog" int4 NOT NULL DEFAULT nextval('t_soggetti_id_sog_seq'::regclass),
"nome_sog" varchar(500) ,
"note" text ,
"data_ins" date ,
"utente_ins" varchar ,
PRIMARY KEY ("id_sog")
)  WITHOUT OIDS;

-- ----------------------------
-- Table structure for "public"."t_toponimi"
-- ----------------------------
drop table "public"."t_toponimi";
CREATE TABLE "public"."t_toponimi"(
"id_top" int4 NOT NULL DEFAULT nextval('t_toponimi_id_top_seq'::regclass),
"nome_top" varchar NOT NULL ,
"note" text ,
"data_ins" date ,
"utente_ins" int4 ,
PRIMARY KEY ("id_top")
)  WITHOUT OIDS;

-- ----------------------------
-- Table structure for "public"."t_utenti"
-- ----------------------------
drop table "public"."t_utenti";
CREATE TABLE "public"."t_utenti"(
"cod_utente" int4 NOT NULL DEFAULT nextval('t_utenti_cod_utente_seq'::regclass),
"username" varchar(18) NOT NULL ,
"passwd" varchar(18) NOT NULL ,
"tipo_utente" varchar NOT NULL ,
"autorizzato" bool NOT NULL DEFAULT false,
"email" varchar(155) ,
"nome" varchar ,
"cognome" varchar ,
PRIMARY KEY ("cod_utente")
)  WITHOUT OIDS;

-- ----------------------------
-- View structure for "public"."v_documenti"
-- ----------------------------
DROP VIEW "public"."v_documenti";
create view "public"."v_documenti" as SELECT t_documenti.nome_doc, t_documenti.luogo, t_documenti.regesto, t_documenti.data_da_a, t_documenti.pagine, t_documenti.brani, t_documenti.doc_integrale, t_documenti.edizione, t_documenti.biblio, t_documenti.note, t_documenti.data_ins, t_documenti.utente_ins FROM t_documenti;;

-- ----------------------------
-- View structure for "public"."v_prossimita"
-- ----------------------------
DROP VIEW "public"."v_prossimita";
create view "public"."v_prossimita" as SELECT t_documenti.id_doc, t_documenti.nome_doc, t_documenti.luogo, t_documenti.data_da_a, t_oggetti.id_ogg, t_oggetti.nome_ogg, t_oggetti.descr_ogg, t_oggetti.cat_ogg, t_oggetti.tipo_ogg, t_prossimita.posizione, t_toponimi.nome_top, t_toponimi.id_top FROM (((t_oggetti JOIN t_prossimita ON ((t_oggetti.id_ogg = t_prossimita.id_ogg))) JOIN t_toponimi ON ((t_toponimi.id_top = t_prossimita.id_top))) JOIN t_documenti ON ((t_documenti.id_doc = t_prossimita.id_doc)));;

-- ----------------------------
-- View structure for "public"."v_eventi2"
-- ----------------------------
DROP VIEW "public"."v_eventi2";
create view "public"."v_eventi2" as SELECT t_eventi.id_eve, t_eventi.id_doc, t_documenti.nome_doc, t_documenti.luogo, t_documenti.regesto, t_eventi.id_ogg, t_oggetti.nome_ogg, t_oggetti.cat_ogg, t_oggetti.tipo_ogg, t_eventi.id_sog, t_eventi.trascr_sog, t_soggetti.nome_sog, t_eventi.id_ist, t_istituzioni.nome_ist, t_eventi.azione, t_eventi.tipo_proprieta, t_eventi.prop_condivisa, t_eventi.data_da_a[1] AS data_ini, t_eventi.data_da_a[2] AS data_fin FROM ((((t_eventi JOIN t_documenti ON ((t_eventi.id_doc = t_documenti.id_doc))) JOIN t_oggetti ON ((t_eventi.id_ogg = t_oggetti.id_ogg))) JOIN t_istituzioni ON ((t_eventi.id_ist = t_istituzioni.id_ist))) JOIN t_soggetti ON ((t_eventi.id_sog = t_soggetti.id_sog)));;

-- ----------------------------
-- Function structure for "pg_catalog"."plpgsql_call_handler"()
-- ----------------------------
DROP FUNCTION "pg_catalog"."plpgsql_call_handler"();
CREATE FUNCTION "pg_catalog"."plpgsql_call_handler"()
  RETURNS language_handler AS '$libdir/plpgsql', 'plpgsql_call_handler'
  LANGUAGE 'c' VOLATILE;
ALTER FUNCTION "pg_catalog"."plpgsql_call_handler"() OWNER TO postgres;
COMMENT ON FUNCTION "pg_catalog"."plpgsql_call_handler"() IS '';
;

-- ----------------------------
-- Function structure for "pg_catalog"."plpgsql_validator"(oid)
-- ----------------------------
DROP FUNCTION "pg_catalog"."plpgsql_validator"(oid);
CREATE FUNCTION "pg_catalog"."plpgsql_validator"(oid)
  RETURNS void AS '$libdir/plpgsql', 'plpgsql_validator'
  LANGUAGE 'c' VOLATILE;
ALTER FUNCTION "pg_catalog"."plpgsql_validator"(oid) OWNER TO postgres;
COMMENT ON FUNCTION "pg_catalog"."plpgsql_validator"(oid) IS '';
;

-- ----------------------------
-- Function structure for "public"."_st_asgml"(int4, "public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."_st_asgml"(int4, "public"."geometry", int4);
CREATE FUNCTION "public"."_st_asgml"(int4, "public"."geometry", int4)
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_asGML'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."_st_asgml"(int4, "public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."_st_asgml"(int4, "public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."_st_askml"(int4, "public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."_st_askml"(int4, "public"."geometry", int4);
CREATE FUNCTION "public"."_st_askml"(int4, "public"."geometry", int4)
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_asKML'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."_st_askml"(int4, "public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."_st_askml"(int4, "public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."_st_contains"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."_st_contains"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."_st_contains"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'contains'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."_st_contains"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."_st_contains"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."_st_crosses"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."_st_crosses"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."_st_crosses"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'crosses'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."_st_crosses"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."_st_crosses"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."_st_intersects"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."_st_intersects"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."_st_intersects"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'intersects'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."_st_intersects"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."_st_intersects"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."_st_overlaps"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."_st_overlaps"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."_st_overlaps"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'overlaps'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."_st_overlaps"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."_st_overlaps"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."_st_touches"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."_st_touches"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."_st_touches"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'touches'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."_st_touches"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."_st_touches"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."_st_within"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."_st_within"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."_st_within"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'within'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."_st_within"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."_st_within"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."addauth"(text)
-- ----------------------------
DROP FUNCTION "public"."addauth"(text);
CREATE FUNCTION "public"."addauth"(text)
  RETURNS bool AS 
$BODY$
DECLARE
	lockid alias for $1;
	okay boolean;
	myrec record;
BEGIN
	-- check to see if table exists
	--  if not, CREATE TEMP TABLE mylock (transid xid, lockcode text)
	okay := 'f';
	FOR myrec IN SELECT * FROM pg_class WHERE relname = 'temp_lock_have_table' LOOP
		okay := 't';
	END LOOP; 
	IF (okay <> 't') THEN 
		CREATE TEMP TABLE temp_lock_have_table (transid xid, lockcode text);
			-- this will only work from pgsql7.4 up
			-- ON COMMIT DELETE ROWS;
	END IF;

	--  INSERT INTO mylock VALUES ( $1)
--	EXECUTE 'INSERT INTO temp_lock_have_table VALUES ( '||
--		quote_literal(getTransactionID()) || ',' ||
--		quote_literal(lockid) ||')';

	INSERT INTO temp_lock_have_table VALUES (getTransactionID(), lockid);

	RETURN true::boolean;
END;
$BODY$  LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION "public"."addauth"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."addauth"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."addbbox"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."addbbox"("public"."geometry");
CREATE FUNCTION "public"."addbbox"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_addBBOX'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."addbbox"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."addbbox"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."addgeometrycolumn"(varchar, varchar, int4, varchar, int4)
-- ----------------------------
DROP FUNCTION "public"."addgeometrycolumn"(varchar, varchar, int4, varchar, int4);
CREATE FUNCTION "public"."addgeometrycolumn"(varchar, varchar, int4, varchar, int4)
  RETURNS text AS 
$BODY$
DECLARE
	ret  text;
BEGIN
	SELECT AddGeometryColumn('','',$1,$2,$3,$4,$5) into ret;
	RETURN ret;
END;
$BODY$  LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION "public"."addgeometrycolumn"(varchar, varchar, int4, varchar, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."addgeometrycolumn"(varchar, varchar, int4, varchar, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."addgeometrycolumn"(varchar, varchar, varchar, varchar, int4, varchar, int4)
-- ----------------------------
DROP FUNCTION "public"."addgeometrycolumn"(varchar, varchar, varchar, varchar, int4, varchar, int4);
CREATE FUNCTION "public"."addgeometrycolumn"(varchar, varchar, varchar, varchar, int4, varchar, int4)
  RETURNS text AS 
$BODY$
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') or
		   (new_type ='GEOMETRYCOLLECTIONM') or
		   (new_type ='POINTM') or 
		   (new_type ='MULTIPOINTM') or
		   (new_type ='POLYGONM') or
		   (new_type ='MULTIPOLYGONM') or
		   (new_type ='LINESTRINGM') or
		   (new_type ='MULTILINESTRINGM') or
                   (new_type = 'CIRCULARSTRING') or
                   (new_type = 'CIRCULARSTRINGM') or
                   (new_type = 'COMPOUNDCURVE') or
                   (new_type = 'COMPOUNDCURVEM') or
                   (new_type = 'CURVEPOLYGON') or
                   (new_type = 'CURVEPOLYGONM') or
                   (new_type = 'MULTICURVE') or
                   (new_type = 'MULTICURVEM') or
                   (new_type = 'MULTISURFACE') or
                   (new_type = 'MULTISURFACEM')) )
	THEN
		RAISE EXCEPTION 'Invalid type name - valid ones are: 
			GEOMETRY, GEOMETRYCOLLECTION, POINT, 
			MULTIPOINT, POLYGON, MULTIPOLYGON, 
			LINESTRING, MULTILINESTRING,
                        CIRCULARSTRING, COMPOUNDCURVE,
                        CURVEPOLYGON, MULTICURVE, MULTISURFACE,
			GEOMETRYCOLLECTIONM, POINTM, 
			MULTIPOINTM, POLYGONM, MULTIPOLYGONM, 
			LINESTRINGM, MULTILINESTRINGM 
                        CIRCULARSTRINGM, COMPOUNDCURVEM,
                        CURVEPOLYGONM, MULTICURVEM or MULTISURFACEM';
		return 'fail';
	END IF;

	IF ( (new_dim >4) or (new_dim <0) ) THEN
		RAISE EXCEPTION 'invalid dimension';
		return 'fail';
	END IF;

	IF ( (new_type LIKE '%M') and (new_dim!=3) ) THEN

		RAISE EXCEPTION 'TypeM needs 3 dimensions';
		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;


	-- Add geometry column

	EXECUTE 'ALTER TABLE ' ||
		quote_ident(real_schema) || '.' || quote_ident(table_name)
		|| ' ADD COLUMN ' || quote_ident(column_name) || 
		' geometry ';


	-- Delete stale record in geometry_column (if any)

	EXECUTE 'DELETE FROM geometry_columns WHERE
		f_table_catalog = ' || quote_literal('') || 
		' AND f_table_schema = ' ||
		quote_literal(real_schema) || 
		' AND f_table_name = ' || quote_literal(table_name) ||
		' AND f_geometry_column = ' || quote_literal(column_name);


	-- Add record in geometry_column 

	EXECUTE 'INSERT INTO geometry_columns VALUES (' ||
		quote_literal('') || ',' ||
		quote_literal(real_schema) || ',' ||
		quote_literal(table_name) || ',' ||
		quote_literal(column_name) || ',' ||
		new_dim::text || ',' || new_srid::text || ',' ||
		quote_literal(new_type) || ')';

	-- Add table checks

	EXECUTE 'ALTER TABLE ' || 
		quote_ident(real_schema) || '.' || quote_ident(table_name)
		|| ' ADD CONSTRAINT ' 
		|| quote_ident('enforce_srid_' || column_name)
		|| ' CHECK (SRID(' || quote_ident(column_name) ||
		') = ' || new_srid::text || ')' ;

	EXECUTE 'ALTER TABLE ' || 
		quote_ident(real_schema) || '.' || quote_ident(table_name)
		|| ' ADD CONSTRAINT '
		|| quote_ident('enforce_dims_' || column_name)
		|| ' CHECK (ndims(' || quote_ident(column_name) ||
		') = ' || new_dim::text || ')' ;

	IF (not(new_type = 'GEOMETRY')) THEN
		EXECUTE 'ALTER TABLE ' || 
		quote_ident(real_schema) || '.' || quote_ident(table_name)
		|| ' ADD CONSTRAINT '
		|| quote_ident('enforce_geotype_' || column_name)
		|| ' CHECK (geometrytype(' ||
		quote_ident(column_name) || ')=' ||
		quote_literal(new_type) || ' OR (' ||
		quote_ident(column_name) || ') is null)';
	END IF;

	return 
		real_schema || '.' || 
		table_name || '.' || column_name ||
		' SRID:' || new_srid::text ||
		' TYPE:' || new_type || 
		' DIMS:' || new_dim::text || chr(10) || ' '; 
END;
$BODY$  LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION "public"."addgeometrycolumn"(varchar, varchar, varchar, varchar, int4, varchar, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."addgeometrycolumn"(varchar, varchar, varchar, varchar, int4, varchar, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."addgeometrycolumn"(varchar, varchar, varchar, int4, varchar, int4)
-- ----------------------------
DROP FUNCTION "public"."addgeometrycolumn"(varchar, varchar, varchar, int4, varchar, int4);
CREATE FUNCTION "public"."addgeometrycolumn"(varchar, varchar, varchar, int4, varchar, int4)
  RETURNS text AS 
$BODY$
DECLARE
	ret  text;
BEGIN
	SELECT AddGeometryColumn('',$1,$2,$3,$4,$5,$6) into ret;
	RETURN ret;
END;
$BODY$  LANGUAGE 'plpgsql' STABLE;
ALTER FUNCTION "public"."addgeometrycolumn"(varchar, varchar, varchar, int4, varchar, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."addgeometrycolumn"(varchar, varchar, varchar, int4, varchar, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."addpoint"("public"."geometry", "public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."addpoint"("public"."geometry", "public"."geometry", int4);
CREATE FUNCTION "public"."addpoint"("public"."geometry", "public"."geometry", int4)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_addpoint'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."addpoint"("public"."geometry", "public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."addpoint"("public"."geometry", "public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."addpoint"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."addpoint"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."addpoint"("public"."geometry", "public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_addpoint'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."addpoint"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."addpoint"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."affine"("public"."geometry", float8, float8, float8, float8, float8, float8)
-- ----------------------------
DROP FUNCTION "public"."affine"("public"."geometry", float8, float8, float8, float8, float8, float8);
CREATE FUNCTION "public"."affine"("public"."geometry", float8, float8, float8, float8, float8, float8)
  RETURNS geometry AS 
$BODY$SELECT affine($1,  $2, $3, 0,  $4, $5, 0,  0, 0, 1,  $6, $7, 0)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."affine"("public"."geometry", float8, float8, float8, float8, float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."affine"("public"."geometry", float8, float8, float8, float8, float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."affine"("public"."geometry", float8, float8, float8, float8, float8, float8, float8, float8, float8, float8, float8, float8)
-- ----------------------------
DROP FUNCTION "public"."affine"("public"."geometry", float8, float8, float8, float8, float8, float8, float8, float8, float8, float8, float8, float8);
CREATE FUNCTION "public"."affine"("public"."geometry", float8, float8, float8, float8, float8, float8, float8, float8, float8, float8, float8, float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_affine'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."affine"("public"."geometry", float8, float8, float8, float8, float8, float8, float8, float8, float8, float8, float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."affine"("public"."geometry", float8, float8, float8, float8, float8, float8, float8, float8, float8, float8, float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."area"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."area"("public"."geometry");
CREATE FUNCTION "public"."area"("public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_area_polygon'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."area"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."area"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."area2d"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."area2d"("public"."geometry");
CREATE FUNCTION "public"."area2d"("public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_area_polygon'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."area2d"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."area2d"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."asbinary"("public"."geometry", text)
-- ----------------------------
DROP FUNCTION "public"."asbinary"("public"."geometry", text);
CREATE FUNCTION "public"."asbinary"("public"."geometry", text)
  RETURNS bytea AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_asBinary'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."asbinary"("public"."geometry", text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."asbinary"("public"."geometry", text) IS '';
;

-- ----------------------------
-- Function structure for "public"."asbinary"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."asbinary"("public"."geometry");
CREATE FUNCTION "public"."asbinary"("public"."geometry")
  RETURNS bytea AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_asBinary'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."asbinary"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."asbinary"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."asewkb"("public"."geometry", text)
-- ----------------------------
DROP FUNCTION "public"."asewkb"("public"."geometry", text);
CREATE FUNCTION "public"."asewkb"("public"."geometry", text)
  RETURNS bytea AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'WKBFromLWGEOM'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."asewkb"("public"."geometry", text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."asewkb"("public"."geometry", text) IS '';
;

-- ----------------------------
-- Function structure for "public"."asewkb"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."asewkb"("public"."geometry");
CREATE FUNCTION "public"."asewkb"("public"."geometry")
  RETURNS bytea AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'WKBFromLWGEOM'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."asewkb"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."asewkb"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."asewkt"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."asewkt"("public"."geometry");
CREATE FUNCTION "public"."asewkt"("public"."geometry")
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_asEWKT'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."asewkt"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."asewkt"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."asgml"("public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."asgml"("public"."geometry", int4);
CREATE FUNCTION "public"."asgml"("public"."geometry", int4)
  RETURNS text AS 
$BODY$SELECT _ST_AsGML(2, $1, $2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."asgml"("public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."asgml"("public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."asgml"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."asgml"("public"."geometry");
CREATE FUNCTION "public"."asgml"("public"."geometry")
  RETURNS text AS 
$BODY$SELECT _ST_AsGML(2, $1, 15)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."asgml"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."asgml"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."ashexewkb"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."ashexewkb"("public"."geometry");
CREATE FUNCTION "public"."ashexewkb"("public"."geometry")
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_asHEXEWKB'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."ashexewkb"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."ashexewkb"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."ashexewkb"("public"."geometry", text)
-- ----------------------------
DROP FUNCTION "public"."ashexewkb"("public"."geometry", text);
CREATE FUNCTION "public"."ashexewkb"("public"."geometry", text)
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_asHEXEWKB'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."ashexewkb"("public"."geometry", text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."ashexewkb"("public"."geometry", text) IS '';
;

-- ----------------------------
-- Function structure for "public"."askml"("public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."askml"("public"."geometry", int4);
CREATE FUNCTION "public"."askml"("public"."geometry", int4)
  RETURNS text AS 
$BODY$SELECT _ST_AsKML(2, transform($1,4326), $2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."askml"("public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."askml"("public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."askml"(int4, "public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."askml"(int4, "public"."geometry", int4);
CREATE FUNCTION "public"."askml"(int4, "public"."geometry", int4)
  RETURNS text AS 
$BODY$SELECT _ST_AsKML($1, transform($2,4326), $3)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."askml"(int4, "public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."askml"(int4, "public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."askml"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."askml"("public"."geometry");
CREATE FUNCTION "public"."askml"("public"."geometry")
  RETURNS text AS 
$BODY$SELECT _ST_AsKML(2, transform($1,4326), 15)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."askml"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."askml"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."assvg"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."assvg"("public"."geometry");
CREATE FUNCTION "public"."assvg"("public"."geometry")
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'assvg_geometry'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."assvg"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."assvg"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."assvg"("public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."assvg"("public"."geometry", int4);
CREATE FUNCTION "public"."assvg"("public"."geometry", int4)
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'assvg_geometry'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."assvg"("public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."assvg"("public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."assvg"("public"."geometry", int4, int4)
-- ----------------------------
DROP FUNCTION "public"."assvg"("public"."geometry", int4, int4);
CREATE FUNCTION "public"."assvg"("public"."geometry", int4, int4)
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'assvg_geometry'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."assvg"("public"."geometry", int4, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."assvg"("public"."geometry", int4, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."astext"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."astext"("public"."geometry");
CREATE FUNCTION "public"."astext"("public"."geometry")
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_asText'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."astext"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."astext"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."azimuth"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."azimuth"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."azimuth"("public"."geometry", "public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_azimuth'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."azimuth"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."azimuth"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."bdmpolyfromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."bdmpolyfromtext"(text, int4);
CREATE FUNCTION "public"."bdmpolyfromtext"(text, int4)
  RETURNS geometry AS 
$BODY$
DECLARE
	geomtext alias for $1;
	srid alias for $2;
	mline geometry;
	geom geometry;
BEGIN
	mline := MultiLineStringFromText(geomtext, srid);

	IF mline IS NULL
	THEN
		RAISE EXCEPTION 'Input is not a MultiLinestring';
	END IF;

	geom := multi(BuildArea(mline));

	RETURN geom;
END;
$BODY$  LANGUAGE 'plpgsql' IMMUTABLE;
ALTER FUNCTION "public"."bdmpolyfromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."bdmpolyfromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."bdpolyfromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."bdpolyfromtext"(text, int4);
CREATE FUNCTION "public"."bdpolyfromtext"(text, int4)
  RETURNS geometry AS 
$BODY$
DECLARE
	geomtext alias for $1;
	srid alias for $2;
	mline geometry;
	geom geometry;
BEGIN
	mline := MultiLineStringFromText(geomtext, srid);

	IF mline IS NULL
	THEN
		RAISE EXCEPTION 'Input is not a MultiLinestring';
	END IF;

	geom := BuildArea(mline);

	IF GeometryType(geom) != 'POLYGON'
	THEN
		RAISE EXCEPTION 'Input returns more then a single polygon, try using BdMPolyFromText instead';
	END IF;

	RETURN geom;
END;
$BODY$  LANGUAGE 'plpgsql' IMMUTABLE;
ALTER FUNCTION "public"."bdpolyfromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."bdpolyfromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."boundary"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."boundary"("public"."geometry");
CREATE FUNCTION "public"."boundary"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'boundary'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."boundary"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."boundary"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."box"("public"."box3d")
-- ----------------------------
DROP FUNCTION "public"."box"("public"."box3d");
CREATE FUNCTION "public"."box"("public"."box3d")
  RETURNS box AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_to_BOX'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."box"("public"."box3d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."box"("public"."box3d") IS '';
;

-- ----------------------------
-- Function structure for "public"."box"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."box"("public"."geometry");
CREATE FUNCTION "public"."box"("public"."geometry")
  RETURNS box AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_to_BOX'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."box"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."box"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."box2d"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."box2d"("public"."geometry");
CREATE FUNCTION "public"."box2d"("public"."geometry")
  RETURNS box2d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_to_BOX2DFLOAT4'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."box2d"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."box2d"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."box2d"("public"."box3d")
-- ----------------------------
DROP FUNCTION "public"."box2d"("public"."box3d");
CREATE FUNCTION "public"."box2d"("public"."box3d")
  RETURNS box2d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_to_BOX2DFLOAT4'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."box2d"("public"."box3d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."box2d"("public"."box3d") IS '';
;

-- ----------------------------
-- Function structure for "public"."box2d_contain"("public"."box2d", "public"."box2d")
-- ----------------------------
DROP FUNCTION "public"."box2d_contain"("public"."box2d", "public"."box2d");
CREATE FUNCTION "public"."box2d_contain"("public"."box2d", "public"."box2d")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2D_contain'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."box2d_contain"("public"."box2d", "public"."box2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."box2d_contain"("public"."box2d", "public"."box2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."box2d_contained"("public"."box2d", "public"."box2d")
-- ----------------------------
DROP FUNCTION "public"."box2d_contained"("public"."box2d", "public"."box2d");
CREATE FUNCTION "public"."box2d_contained"("public"."box2d", "public"."box2d")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2D_contained'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."box2d_contained"("public"."box2d", "public"."box2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."box2d_contained"("public"."box2d", "public"."box2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."box2d_in"(cstring)
-- ----------------------------
DROP FUNCTION "public"."box2d_in"(cstring);
CREATE FUNCTION "public"."box2d_in"(cstring)
  RETURNS box2d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2DFLOAT4_in'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."box2d_in"(cstring) OWNER TO postgres;
COMMENT ON FUNCTION "public"."box2d_in"(cstring) IS '';
;

-- ----------------------------
-- Function structure for "public"."box2d_intersects"("public"."box2d", "public"."box2d")
-- ----------------------------
DROP FUNCTION "public"."box2d_intersects"("public"."box2d", "public"."box2d");
CREATE FUNCTION "public"."box2d_intersects"("public"."box2d", "public"."box2d")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2D_intersects'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."box2d_intersects"("public"."box2d", "public"."box2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."box2d_intersects"("public"."box2d", "public"."box2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."box2d_left"("public"."box2d", "public"."box2d")
-- ----------------------------
DROP FUNCTION "public"."box2d_left"("public"."box2d", "public"."box2d");
CREATE FUNCTION "public"."box2d_left"("public"."box2d", "public"."box2d")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2D_left'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."box2d_left"("public"."box2d", "public"."box2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."box2d_left"("public"."box2d", "public"."box2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."box2d_out"("public"."box2d")
-- ----------------------------
DROP FUNCTION "public"."box2d_out"("public"."box2d");
CREATE FUNCTION "public"."box2d_out"("public"."box2d")
  RETURNS cstring AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2DFLOAT4_out'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."box2d_out"("public"."box2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."box2d_out"("public"."box2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."box2d_overlap"("public"."box2d", "public"."box2d")
-- ----------------------------
DROP FUNCTION "public"."box2d_overlap"("public"."box2d", "public"."box2d");
CREATE FUNCTION "public"."box2d_overlap"("public"."box2d", "public"."box2d")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2D_overlap'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."box2d_overlap"("public"."box2d", "public"."box2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."box2d_overlap"("public"."box2d", "public"."box2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."box2d_overleft"("public"."box2d", "public"."box2d")
-- ----------------------------
DROP FUNCTION "public"."box2d_overleft"("public"."box2d", "public"."box2d");
CREATE FUNCTION "public"."box2d_overleft"("public"."box2d", "public"."box2d")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2D_overleft'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."box2d_overleft"("public"."box2d", "public"."box2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."box2d_overleft"("public"."box2d", "public"."box2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."box2d_overright"("public"."box2d", "public"."box2d")
-- ----------------------------
DROP FUNCTION "public"."box2d_overright"("public"."box2d", "public"."box2d");
CREATE FUNCTION "public"."box2d_overright"("public"."box2d", "public"."box2d")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2D_overright'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."box2d_overright"("public"."box2d", "public"."box2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."box2d_overright"("public"."box2d", "public"."box2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."box2d_right"("public"."box2d", "public"."box2d")
-- ----------------------------
DROP FUNCTION "public"."box2d_right"("public"."box2d", "public"."box2d");
CREATE FUNCTION "public"."box2d_right"("public"."box2d", "public"."box2d")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2D_right'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."box2d_right"("public"."box2d", "public"."box2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."box2d_right"("public"."box2d", "public"."box2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."box2d_same"("public"."box2d", "public"."box2d")
-- ----------------------------
DROP FUNCTION "public"."box2d_same"("public"."box2d", "public"."box2d");
CREATE FUNCTION "public"."box2d_same"("public"."box2d", "public"."box2d")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2D_same'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."box2d_same"("public"."box2d", "public"."box2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."box2d_same"("public"."box2d", "public"."box2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."box3d"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."box3d"("public"."geometry");
CREATE FUNCTION "public"."box3d"("public"."geometry")
  RETURNS box3d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_to_BOX3D'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."box3d"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."box3d"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."box3d"("public"."box2d")
-- ----------------------------
DROP FUNCTION "public"."box3d"("public"."box2d");
CREATE FUNCTION "public"."box3d"("public"."box2d")
  RETURNS box3d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2DFLOAT4_to_BOX3D'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."box3d"("public"."box2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."box3d"("public"."box2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."box3d_in"(cstring)
-- ----------------------------
DROP FUNCTION "public"."box3d_in"(cstring);
CREATE FUNCTION "public"."box3d_in"(cstring)
  RETURNS box3d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_in'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."box3d_in"(cstring) OWNER TO postgres;
COMMENT ON FUNCTION "public"."box3d_in"(cstring) IS '';
;

-- ----------------------------
-- Function structure for "public"."box3d_out"("public"."box3d")
-- ----------------------------
DROP FUNCTION "public"."box3d_out"("public"."box3d");
CREATE FUNCTION "public"."box3d_out"("public"."box3d")
  RETURNS cstring AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_out'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."box3d_out"("public"."box3d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."box3d_out"("public"."box3d") IS '';
;

-- ----------------------------
-- Function structure for "public"."box3dtobox"("public"."box3d")
-- ----------------------------
DROP FUNCTION "public"."box3dtobox"("public"."box3d");
CREATE FUNCTION "public"."box3dtobox"("public"."box3d")
  RETURNS box AS 
$BODY$SELECT box($1)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."box3dtobox"("public"."box3d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."box3dtobox"("public"."box3d") IS '';
;

-- ----------------------------
-- Function structure for "public"."buffer"("public"."geometry", float8, int4)
-- ----------------------------
DROP FUNCTION "public"."buffer"("public"."geometry", float8, int4);
CREATE FUNCTION "public"."buffer"("public"."geometry", float8, int4)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'buffer'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."buffer"("public"."geometry", float8, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."buffer"("public"."geometry", float8, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."buffer"("public"."geometry", float8)
-- ----------------------------
DROP FUNCTION "public"."buffer"("public"."geometry", float8);
CREATE FUNCTION "public"."buffer"("public"."geometry", float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'buffer'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."buffer"("public"."geometry", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."buffer"("public"."geometry", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."build_histogram2d"("public"."histogram2d", text, text, text)
-- ----------------------------
DROP FUNCTION "public"."build_histogram2d"("public"."histogram2d", text, text, text);
CREATE FUNCTION "public"."build_histogram2d"("public"."histogram2d", text, text, text)
  RETURNS histogram2d AS 
$BODY$
BEGIN
	EXECUTE 'SET local search_path = '||$2||',public';
	RETURN public.build_histogram2d($1,$3,$4);
END
$BODY$  LANGUAGE 'plpgsql' STABLE;
ALTER FUNCTION "public"."build_histogram2d"("public"."histogram2d", text, text, text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."build_histogram2d"("public"."histogram2d", text, text, text) IS '';
;

-- ----------------------------
-- Function structure for "public"."build_histogram2d"("public"."histogram2d", text, text)
-- ----------------------------
DROP FUNCTION "public"."build_histogram2d"("public"."histogram2d", text, text);
CREATE FUNCTION "public"."build_histogram2d"("public"."histogram2d", text, text)
  RETURNS histogram2d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'build_lwhistogram2d'
  LANGUAGE 'c' STABLE;
ALTER FUNCTION "public"."build_histogram2d"("public"."histogram2d", text, text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."build_histogram2d"("public"."histogram2d", text, text) IS '';
;

-- ----------------------------
-- Function structure for "public"."buildarea"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."buildarea"("public"."geometry");
CREATE FUNCTION "public"."buildarea"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_buildarea'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."buildarea"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."buildarea"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."bytea"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."bytea"("public"."geometry");
CREATE FUNCTION "public"."bytea"("public"."geometry")
  RETURNS bytea AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_to_bytea'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."bytea"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."bytea"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."cache_bbox"()
-- ----------------------------
DROP FUNCTION "public"."cache_bbox"();
CREATE FUNCTION "public"."cache_bbox"()
  RETURNS trigger AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'cache_bbox'
  LANGUAGE 'c' VOLATILE;
ALTER FUNCTION "public"."cache_bbox"() OWNER TO postgres;
COMMENT ON FUNCTION "public"."cache_bbox"() IS '';
;

-- ----------------------------
-- Function structure for "public"."centroid"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."centroid"("public"."geometry");
CREATE FUNCTION "public"."centroid"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'centroid'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."centroid"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."centroid"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."checkauth"(text, text)
-- ----------------------------
DROP FUNCTION "public"."checkauth"(text, text);
CREATE FUNCTION "public"."checkauth"(text, text)
  RETURNS int4 AS 
$BODY$SELECT CheckAuth('', $1, $2)$BODY$  LANGUAGE 'sql' VOLATILE;
ALTER FUNCTION "public"."checkauth"(text, text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."checkauth"(text, text) IS '';
;

-- ----------------------------
-- Function structure for "public"."checkauth"(text, text, text)
-- ----------------------------
DROP FUNCTION "public"."checkauth"(text, text, text);
CREATE FUNCTION "public"."checkauth"(text, text, text)
  RETURNS int4 AS 
$BODY$
DECLARE
	schema text;
BEGIN
	IF NOT LongTransactionsEnabled() THEN
		RAISE EXCEPTION 'Long transaction support disabled, use EnableLongTransaction() to enable.';
	END IF;

	if ( $1 != '' ) THEN
		schema = $1;
	ELSE
		SELECT current_schema() into schema;
	END IF;

	-- TODO: check for an already existing trigger ?

	EXECUTE 'CREATE TRIGGER check_auth BEFORE UPDATE OR DELETE ON ' 
		|| quote_ident(schema) || '.' || quote_ident($2)
		||' FOR EACH ROW EXECUTE PROCEDURE CheckAuthTrigger('
		|| quote_literal($3) || ')';

	RETURN 0;
END;
$BODY$  LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION "public"."checkauth"(text, text, text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."checkauth"(text, text, text) IS '';
;

-- ----------------------------
-- Function structure for "public"."checkauthtrigger"()
-- ----------------------------
DROP FUNCTION "public"."checkauthtrigger"();
CREATE FUNCTION "public"."checkauthtrigger"()
  RETURNS trigger AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'check_authorization'
  LANGUAGE 'c' VOLATILE;
ALTER FUNCTION "public"."checkauthtrigger"() OWNER TO postgres;
COMMENT ON FUNCTION "public"."checkauthtrigger"() IS '';
;

-- ----------------------------
-- Function structure for "public"."chip_in"(cstring)
-- ----------------------------
DROP FUNCTION "public"."chip_in"(cstring);
CREATE FUNCTION "public"."chip_in"(cstring)
  RETURNS chip AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'CHIP_in'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."chip_in"(cstring) OWNER TO postgres;
COMMENT ON FUNCTION "public"."chip_in"(cstring) IS '';
;

-- ----------------------------
-- Function structure for "public"."chip_out"("public"."chip")
-- ----------------------------
DROP FUNCTION "public"."chip_out"("public"."chip");
CREATE FUNCTION "public"."chip_out"("public"."chip")
  RETURNS cstring AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'CHIP_out'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."chip_out"("public"."chip") OWNER TO postgres;
COMMENT ON FUNCTION "public"."chip_out"("public"."chip") IS '';
;

-- ----------------------------
-- Function structure for "public"."collect"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."collect"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."collect"("public"."geometry", "public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_collect'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."collect"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."collect"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."collect_garray"("public"."_geometry")
-- ----------------------------
DROP FUNCTION "public"."collect_garray"("public"."_geometry");
CREATE FUNCTION "public"."collect_garray"("public"."_geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_collect_garray'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."collect_garray"("public"."_geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."collect_garray"("public"."_geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."collector"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."collector"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."collector"("public"."geometry", "public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_collect'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."collector"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."collector"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."combine_bbox"("public"."box2d", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."combine_bbox"("public"."box2d", "public"."geometry");
CREATE FUNCTION "public"."combine_bbox"("public"."box2d", "public"."geometry")
  RETURNS box2d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2DFLOAT4_combine'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."combine_bbox"("public"."box2d", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."combine_bbox"("public"."box2d", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."combine_bbox"("public"."box3d", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."combine_bbox"("public"."box3d", "public"."geometry");
CREATE FUNCTION "public"."combine_bbox"("public"."box3d", "public"."geometry")
  RETURNS box3d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_combine'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."combine_bbox"("public"."box3d", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."combine_bbox"("public"."box3d", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."compression"("public"."chip")
-- ----------------------------
DROP FUNCTION "public"."compression"("public"."chip");
CREATE FUNCTION "public"."compression"("public"."chip")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'CHIP_getCompression'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."compression"("public"."chip") OWNER TO postgres;
COMMENT ON FUNCTION "public"."compression"("public"."chip") IS '';
;

-- ----------------------------
-- Function structure for "public"."contains"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."contains"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."contains"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'contains'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."contains"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."contains"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."convexhull"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."convexhull"("public"."geometry");
CREATE FUNCTION "public"."convexhull"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'convexhull'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."convexhull"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."convexhull"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."create_histogram2d"("public"."box2d", int4)
-- ----------------------------
DROP FUNCTION "public"."create_histogram2d"("public"."box2d", int4);
CREATE FUNCTION "public"."create_histogram2d"("public"."box2d", int4)
  RETURNS histogram2d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'create_lwhistogram2d'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."create_histogram2d"("public"."box2d", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."create_histogram2d"("public"."box2d", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."crosses"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."crosses"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."crosses"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'crosses'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."crosses"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."crosses"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."datatype"("public"."chip")
-- ----------------------------
DROP FUNCTION "public"."datatype"("public"."chip");
CREATE FUNCTION "public"."datatype"("public"."chip")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'CHIP_getDatatype'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."datatype"("public"."chip") OWNER TO postgres;
COMMENT ON FUNCTION "public"."datatype"("public"."chip") IS '';
;

-- ----------------------------
-- Function structure for "public"."difference"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."difference"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."difference"("public"."geometry", "public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'difference'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."difference"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."difference"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."dimension"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."dimension"("public"."geometry");
CREATE FUNCTION "public"."dimension"("public"."geometry")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_dimension'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."dimension"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."dimension"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."disablelongtransactions"()
-- ----------------------------
DROP FUNCTION "public"."disablelongtransactions"();
CREATE FUNCTION "public"."disablelongtransactions"()
  RETURNS text AS 
$BODY$
DECLARE
	rec RECORD;

BEGIN

	--
	-- Drop all triggers applied by CheckAuth()
	--
	FOR rec IN
		SELECT c.relname, t.tgname, t.tgargs FROM pg_trigger t, pg_class c, pg_proc p
		WHERE p.proname = 'checkauthtrigger' and t.tgfoid = p.oid and t.tgrelid = c.oid
	LOOP
		EXECUTE 'DROP TRIGGER ' || quote_ident(rec.tgname) ||
			' ON ' || quote_ident(rec.relname);
	END LOOP;

	--
	-- Drop the authorization_table table
	--
	FOR rec IN SELECT * FROM pg_class WHERE relname = 'authorization_table' LOOP
		DROP TABLE authorization_table;
	END LOOP;

	--
	-- Drop the authorized_tables view
	--
	FOR rec IN SELECT * FROM pg_class WHERE relname = 'authorized_tables' LOOP
		DROP VIEW authorized_tables;
	END LOOP;

	RETURN 'Long transactions support disabled';
END;
$BODY$  LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION "public"."disablelongtransactions"() OWNER TO postgres;
COMMENT ON FUNCTION "public"."disablelongtransactions"() IS '';
;

-- ----------------------------
-- Function structure for "public"."disjoint"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."disjoint"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."disjoint"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'disjoint'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."disjoint"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."disjoint"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."distance"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."distance"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."distance"("public"."geometry", "public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_mindistance2d'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."distance"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."distance"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."distance_sphere"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."distance_sphere"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."distance_sphere"("public"."geometry", "public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_distance_sphere'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."distance_sphere"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."distance_sphere"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."distance_spheroid"("public"."geometry", "public"."geometry", "public"."spheroid")
-- ----------------------------
DROP FUNCTION "public"."distance_spheroid"("public"."geometry", "public"."geometry", "public"."spheroid");
CREATE FUNCTION "public"."distance_spheroid"("public"."geometry", "public"."geometry", "public"."spheroid")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_distance_ellipsoid_point'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."distance_spheroid"("public"."geometry", "public"."geometry", "public"."spheroid") OWNER TO postgres;
COMMENT ON FUNCTION "public"."distance_spheroid"("public"."geometry", "public"."geometry", "public"."spheroid") IS '';
;

-- ----------------------------
-- Function structure for "public"."dropbbox"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."dropbbox"("public"."geometry");
CREATE FUNCTION "public"."dropbbox"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_dropBBOX'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."dropbbox"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."dropbbox"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."dropgeometrycolumn"(varchar, varchar)
-- ----------------------------
DROP FUNCTION "public"."dropgeometrycolumn"(varchar, varchar);
CREATE FUNCTION "public"."dropgeometrycolumn"(varchar, varchar)
  RETURNS text AS 
$BODY$
DECLARE
	ret text;
BEGIN
	SELECT DropGeometryColumn('','',$1,$2) into ret;
	RETURN ret;
END;
$BODY$  LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION "public"."dropgeometrycolumn"(varchar, varchar) OWNER TO postgres;
COMMENT ON FUNCTION "public"."dropgeometrycolumn"(varchar, varchar) IS '';
;

-- ----------------------------
-- Function structure for "public"."dropgeometrycolumn"(varchar, varchar, varchar, varchar)
-- ----------------------------
DROP FUNCTION "public"."dropgeometrycolumn"(varchar, varchar, varchar, varchar);
CREATE FUNCTION "public"."dropgeometrycolumn"(varchar, varchar, varchar, varchar)
  RETURNS text AS 
$BODY$
DECLARE
	catalog_name alias for $1; 
	schema_name alias for $2;
	table_name alias for $3;
	column_name alias for $4;
	myrec RECORD;
	okay boolean;
	real_schema name;

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;

 	-- 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;
$BODY$  LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION "public"."dropgeometrycolumn"(varchar, varchar, varchar, varchar) OWNER TO postgres;
COMMENT ON FUNCTION "public"."dropgeometrycolumn"(varchar, varchar, varchar, varchar) IS '';
;

-- ----------------------------
-- Function structure for "public"."dropgeometrycolumn"(varchar, varchar, varchar)
-- ----------------------------
DROP FUNCTION "public"."dropgeometrycolumn"(varchar, varchar, varchar);
CREATE FUNCTION "public"."dropgeometrycolumn"(varchar, varchar, varchar)
  RETURNS text AS 
$BODY$
DECLARE
	ret text;
BEGIN
	SELECT DropGeometryColumn('',$1,$2,$3) into ret;
	RETURN ret;
END;
$BODY$  LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION "public"."dropgeometrycolumn"(varchar, varchar, varchar) OWNER TO postgres;
COMMENT ON FUNCTION "public"."dropgeometrycolumn"(varchar, varchar, varchar) IS '';
;

-- ----------------------------
-- Function structure for "public"."dropgeometrytable"(varchar, varchar, varchar)
-- ----------------------------
DROP FUNCTION "public"."dropgeometrytable"(varchar, varchar, varchar);
CREATE FUNCTION "public"."dropgeometrytable"(varchar, varchar, varchar)
  RETURNS text AS 
$BODY$
DECLARE
	catalog_name alias for $1; 
	schema_name alias for $2;
	table_name alias for $3;
	real_schema name;

BEGIN

	IF ( schema_name = '' ) THEN
		SELECT current_schema() into real_schema;
	ELSE
		real_schema = schema_name;
	END IF;

	-- Remove refs 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);
	
	-- Remove table 
	EXECUTE 'DROP TABLE '
		|| quote_ident(real_schema) || '.' ||
		quote_ident(table_name);

	RETURN
		real_schema || '.' ||
		table_name ||' dropped.';
	
END;
$BODY$  LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION "public"."dropgeometrytable"(varchar, varchar, varchar) OWNER TO postgres;
COMMENT ON FUNCTION "public"."dropgeometrytable"(varchar, varchar, varchar) IS '';
;

-- ----------------------------
-- Function structure for "public"."dropgeometrytable"(varchar)
-- ----------------------------
DROP FUNCTION "public"."dropgeometrytable"(varchar);
CREATE FUNCTION "public"."dropgeometrytable"(varchar)
  RETURNS text AS 
$BODY$SELECT DropGeometryTable('','',$1)$BODY$  LANGUAGE 'sql' VOLATILE;
ALTER FUNCTION "public"."dropgeometrytable"(varchar) OWNER TO postgres;
COMMENT ON FUNCTION "public"."dropgeometrytable"(varchar) IS '';
;

-- ----------------------------
-- Function structure for "public"."dropgeometrytable"(varchar, varchar)
-- ----------------------------
DROP FUNCTION "public"."dropgeometrytable"(varchar, varchar);
CREATE FUNCTION "public"."dropgeometrytable"(varchar, varchar)
  RETURNS text AS 
$BODY$SELECT DropGeometryTable('',$1,$2)$BODY$  LANGUAGE 'sql' VOLATILE;
ALTER FUNCTION "public"."dropgeometrytable"(varchar, varchar) OWNER TO postgres;
COMMENT ON FUNCTION "public"."dropgeometrytable"(varchar, varchar) IS '';
;

-- ----------------------------
-- Function structure for "public"."dump"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."dump"("public"."geometry");
CREATE FUNCTION "public"."dump"("public"."geometry")
  RETURNS geometry_dump AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_dump'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."dump"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."dump"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."dumprings"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."dumprings"("public"."geometry");
CREATE FUNCTION "public"."dumprings"("public"."geometry")
  RETURNS geometry_dump AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_dump_rings'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."dumprings"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."dumprings"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."enablelongtransactions"()
-- ----------------------------
DROP FUNCTION "public"."enablelongtransactions"();
CREATE FUNCTION "public"."enablelongtransactions"()
  RETURNS text AS 
$BODY$
DECLARE
	"query" text;
	exists bool;
	rec RECORD;

BEGIN

	exists = 'f';
	FOR rec IN SELECT * FROM pg_class WHERE relname = 'authorization_table'
	LOOP
		exists = 't';
	END LOOP;

	IF NOT exists
	THEN
		"query" = 'CREATE TABLE authorization_table (
			toid oid, -- table oid
			rid text, -- row id
			expires timestamp,
			authid text
		)';
		EXECUTE "query";
	END IF;

	exists = 'f';
	FOR rec IN SELECT * FROM pg_class WHERE relname = 'authorized_tables'
	LOOP
		exists = 't';
	END LOOP;

	IF NOT exists THEN
		"query" = 'CREATE VIEW authorized_tables AS ' ||
			'SELECT ' ||
			'n.nspname as schema, ' ||
			'c.relname as table, trim(' ||
			quote_literal(chr(92) || '000') ||
			' from t.tgargs) as id_column ' ||
			'FROM pg_trigger t, pg_class c, pg_proc p ' ||
			', pg_namespace n ' ||
			'WHERE p.proname = ' || quote_literal('checkauthtrigger') ||
			' AND c.relnamespace = n.oid' ||
			' AND t.tgfoid = p.oid and t.tgrelid = c.oid';
		EXECUTE "query";
	END IF;

	RETURN 'Long transactions support enabled';
END;
$BODY$  LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION "public"."enablelongtransactions"() OWNER TO postgres;
COMMENT ON FUNCTION "public"."enablelongtransactions"() IS '';
;

-- ----------------------------
-- Function structure for "public"."endpoint"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."endpoint"("public"."geometry");
CREATE FUNCTION "public"."endpoint"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_endpoint_linestring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."endpoint"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."endpoint"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."envelope"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."envelope"("public"."geometry");
CREATE FUNCTION "public"."envelope"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_envelope'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."envelope"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."envelope"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."equals"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."equals"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."equals"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'geomequals'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."equals"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."equals"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."estimate_histogram2d"("public"."histogram2d", "public"."box2d")
-- ----------------------------
DROP FUNCTION "public"."estimate_histogram2d"("public"."histogram2d", "public"."box2d");
CREATE FUNCTION "public"."estimate_histogram2d"("public"."histogram2d", "public"."box2d")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'estimate_lwhistogram2d'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."estimate_histogram2d"("public"."histogram2d", "public"."box2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."estimate_histogram2d"("public"."histogram2d", "public"."box2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."estimated_extent"(text, text, text)
-- ----------------------------
DROP FUNCTION "public"."estimated_extent"(text, text, text);
CREATE FUNCTION "public"."estimated_extent"(text, text, text)
  RETURNS box2d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_estimated_extent'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."estimated_extent"(text, text, text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."estimated_extent"(text, text, text) IS '';
;

-- ----------------------------
-- Function structure for "public"."estimated_extent"(text, text)
-- ----------------------------
DROP FUNCTION "public"."estimated_extent"(text, text);
CREATE FUNCTION "public"."estimated_extent"(text, text)
  RETURNS box2d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_estimated_extent'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."estimated_extent"(text, text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."estimated_extent"(text, text) IS '';
;

-- ----------------------------
-- Function structure for "public"."expand"("public"."geometry", float8)
-- ----------------------------
DROP FUNCTION "public"."expand"("public"."geometry", float8);
CREATE FUNCTION "public"."expand"("public"."geometry", float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_expand'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."expand"("public"."geometry", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."expand"("public"."geometry", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."expand"("public"."box2d", float8)
-- ----------------------------
DROP FUNCTION "public"."expand"("public"."box2d", float8);
CREATE FUNCTION "public"."expand"("public"."box2d", float8)
  RETURNS box2d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2DFLOAT4_expand'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."expand"("public"."box2d", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."expand"("public"."box2d", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."expand"("public"."box3d", float8)
-- ----------------------------
DROP FUNCTION "public"."expand"("public"."box3d", float8);
CREATE FUNCTION "public"."expand"("public"."box3d", float8)
  RETURNS box3d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_expand'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."expand"("public"."box3d", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."expand"("public"."box3d", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."explode_histogram2d"("public"."histogram2d", text)
-- ----------------------------
DROP FUNCTION "public"."explode_histogram2d"("public"."histogram2d", text);
CREATE FUNCTION "public"."explode_histogram2d"("public"."histogram2d", text)
  RETURNS histogram2d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'explode_lwhistogram2d'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."explode_histogram2d"("public"."histogram2d", text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."explode_histogram2d"("public"."histogram2d", text) IS '';
;

-- ----------------------------
-- Function structure for "public"."exteriorring"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."exteriorring"("public"."geometry");
CREATE FUNCTION "public"."exteriorring"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_exteriorring_polygon'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."exteriorring"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."exteriorring"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."factor"("public"."chip")
-- ----------------------------
DROP FUNCTION "public"."factor"("public"."chip");
CREATE FUNCTION "public"."factor"("public"."chip")
  RETURNS float4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'CHIP_getFactor'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."factor"("public"."chip") OWNER TO postgres;
COMMENT ON FUNCTION "public"."factor"("public"."chip") IS '';
;

-- ----------------------------
-- Function structure for "public"."find_extent"(text, text, text)
-- ----------------------------
DROP FUNCTION "public"."find_extent"(text, text, text);
CREATE FUNCTION "public"."find_extent"(text, text, text)
  RETURNS box2d AS 
$BODY$
DECLARE
	schemaname alias for $1;
	tablename alias for $2;
	columnname alias for $3;
	myrec RECORD;

BEGIN
	FOR myrec IN EXECUTE 'SELECT extent("'||columnname||'") FROM "'||schemaname||'"."'||tablename||'"' LOOP
		return myrec.extent;
	END LOOP; 
END;
$BODY$  LANGUAGE 'plpgsql' IMMUTABLE;
ALTER FUNCTION "public"."find_extent"(text, text, text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."find_extent"(text, text, text) IS '';
;

-- ----------------------------
-- Function structure for "public"."find_extent"(text, text)
-- ----------------------------
DROP FUNCTION "public"."find_extent"(text, text);
CREATE FUNCTION "public"."find_extent"(text, text)
  RETURNS box2d AS 
$BODY$
DECLARE
	tablename alias for $1;
	columnname alias for $2;
	myrec RECORD;

BEGIN
	FOR myrec IN EXECUTE 'SELECT extent("'||columnname||'") FROM "'||tablename||'"' LOOP
		return myrec.extent;
	END LOOP; 
END;
$BODY$  LANGUAGE 'plpgsql' IMMUTABLE;
ALTER FUNCTION "public"."find_extent"(text, text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."find_extent"(text, text) IS '';
;

-- ----------------------------
-- Function structure for "public"."find_srid"(varchar, varchar, varchar)
-- ----------------------------
DROP FUNCTION "public"."find_srid"(varchar, varchar, varchar);
CREATE FUNCTION "public"."find_srid"(varchar, varchar, varchar)
  RETURNS int4 AS 
$BODY$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;
$BODY$  LANGUAGE 'plpgsql' IMMUTABLE;
ALTER FUNCTION "public"."find_srid"(varchar, varchar, varchar) OWNER TO postgres;
COMMENT ON FUNCTION "public"."find_srid"(varchar, varchar, varchar) IS '';
;

-- ----------------------------
-- Function structure for "public"."fix_geometry_columns"()
-- ----------------------------
DROP FUNCTION "public"."fix_geometry_columns"();
CREATE FUNCTION "public"."fix_geometry_columns"()
  RETURNS text AS 
$BODY$
DECLARE
	mislinked record;
	result text;
	linked integer;
	deleted integer;
	foundschema integer;
BEGIN

	-- Since 7.3 schema support has been added.
	-- Previous postgis versions used to put the database name in
	-- the schema column. This needs to be fixed, so we try to 
	-- set the correct schema for each geometry_colums record
	-- looking at table, column, type and srid.
	UPDATE geometry_columns SET f_table_schema = n.nspname
		FROM pg_namespace n, pg_class c, pg_attribute a,
			pg_constraint sridcheck, pg_constraint typecheck
                WHERE ( f_table_schema is NULL
		OR f_table_schema = ''
                OR f_table_schema NOT IN (
                        SELECT nspname::varchar
                        FROM pg_namespace nn, pg_class cc, pg_attribute aa
                        WHERE cc.relnamespace = nn.oid
                        AND cc.relname = f_table_name::name
                        AND aa.attrelid = cc.oid
                        AND aa.attname = f_geometry_column::name))
                AND f_table_name::name = c.relname
                AND c.oid = a.attrelid
                AND c.relnamespace = n.oid
                AND f_geometry_column::name = a.attname

                AND sridcheck.conrelid = c.oid
		AND sridcheck.consrc LIKE '(srid(% = %)'
                AND sridcheck.consrc ~ textcat(' = ', srid::text)

                AND typecheck.conrelid = c.oid
		AND typecheck.consrc LIKE
	'((geometrytype(%) = ''%''::text) OR (% IS NULL))'
                AND typecheck.consrc ~ textcat(' = ''', type::text)

                AND NOT EXISTS (
                        SELECT oid FROM geometry_columns gc
                        WHERE c.relname::varchar = gc.f_table_name
                        AND n.nspname::varchar = gc.f_table_schema
                        AND a.attname::varchar = gc.f_geometry_column
                );

	GET DIAGNOSTICS foundschema = ROW_COUNT;

	-- no linkage to system table needed
	return 'fixed:'||foundschema::text;

	-- fix linking to system tables
	SELECT 0 INTO linked;
	FOR mislinked in
		SELECT gc.oid as gcrec,
			a.attrelid as attrelid, a.attnum as attnum
                FROM geometry_columns gc, pg_class c,
		pg_namespace n, pg_attribute a
                WHERE ( gc.attrelid IS NULL OR gc.attrelid != a.attrelid 
			OR gc.varattnum IS NULL OR gc.varattnum != a.attnum)
                AND n.nspname = gc.f_table_schema::name
                AND c.relnamespace = n.oid
                AND c.relname = gc.f_table_name::name
                AND a.attname = f_geometry_column::name
                AND a.attrelid = c.oid
	LOOP
		UPDATE geometry_columns SET
			attrelid = mislinked.attrelid,
			varattnum = mislinked.attnum,
			stats = NULL
			WHERE geometry_columns.oid = mislinked.gcrec;
		SELECT linked+1 INTO linked;
	END LOOP; 

	-- remove stale records
	DELETE FROM geometry_columns WHERE attrelid IS NULL;

	GET DIAGNOSTICS deleted = ROW_COUNT;

	result = 
		'fixed:' || foundschema::text ||
		' linked:' || linked::text || 
		' deleted:' || deleted::text;

	return result;

END;
$BODY$  LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION "public"."fix_geometry_columns"() OWNER TO postgres;
COMMENT ON FUNCTION "public"."fix_geometry_columns"() IS '';
;

-- ----------------------------
-- Function structure for "public"."force_2d"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."force_2d"("public"."geometry");
CREATE FUNCTION "public"."force_2d"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_force_2d'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."force_2d"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."force_2d"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."force_3d"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."force_3d"("public"."geometry");
CREATE FUNCTION "public"."force_3d"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_force_3dz'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."force_3d"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."force_3d"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."force_3dm"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."force_3dm"("public"."geometry");
CREATE FUNCTION "public"."force_3dm"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_force_3dm'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."force_3dm"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."force_3dm"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."force_3dz"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."force_3dz"("public"."geometry");
CREATE FUNCTION "public"."force_3dz"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_force_3dz'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."force_3dz"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."force_3dz"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."force_4d"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."force_4d"("public"."geometry");
CREATE FUNCTION "public"."force_4d"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_force_4d'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."force_4d"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."force_4d"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."force_collection"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."force_collection"("public"."geometry");
CREATE FUNCTION "public"."force_collection"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_force_collection'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."force_collection"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."force_collection"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."forcerhr"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."forcerhr"("public"."geometry");
CREATE FUNCTION "public"."forcerhr"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_forceRHR_poly'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."forcerhr"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."forcerhr"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."geom_accum"("public"."_geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."geom_accum"("public"."_geometry", "public"."geometry");
CREATE FUNCTION "public"."geom_accum"("public"."_geometry", "public"."geometry")
  RETURNS _geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_accum'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geom_accum"("public"."_geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geom_accum"("public"."_geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."geomcollfromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."geomcollfromtext"(text);
CREATE FUNCTION "public"."geomcollfromtext"(text)
  RETURNS geometry AS 
$BODY$
	SELECT CASE
	WHEN geometrytype(GeomFromText($1)) = 'GEOMETRYCOLLECTION'
	THEN GeomFromText($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."geomcollfromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."geomcollfromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."geomcollfromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."geomcollfromtext"(text, int4);
CREATE FUNCTION "public"."geomcollfromtext"(text, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE
	WHEN geometrytype(GeomFromText($1, $2)) = 'GEOMETRYCOLLECTION'
	THEN GeomFromText($1,$2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."geomcollfromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."geomcollfromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."geomcollfromwkb"(bytea, int4)
-- ----------------------------
DROP FUNCTION "public"."geomcollfromwkb"(bytea, int4);
CREATE FUNCTION "public"."geomcollfromwkb"(bytea, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE
	WHEN geometrytype(GeomFromWKB($1, $2)) = 'GEOMETRYCOLLECTION'
	THEN GeomFromWKB($1, $2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."geomcollfromwkb"(bytea, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."geomcollfromwkb"(bytea, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."geomcollfromwkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."geomcollfromwkb"(bytea);
CREATE FUNCTION "public"."geomcollfromwkb"(bytea)
  RETURNS geometry AS 
$BODY$
	SELECT CASE
	WHEN geometrytype(GeomFromWKB($1)) = 'GEOMETRYCOLLECTION'
	THEN GeomFromWKB($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."geomcollfromwkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."geomcollfromwkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry"("public"."box3d")
-- ----------------------------
DROP FUNCTION "public"."geometry"("public"."box3d");
CREATE FUNCTION "public"."geometry"("public"."box3d")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_to_LWGEOM'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry"("public"."box3d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry"("public"."box3d") IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry"(bytea)
-- ----------------------------
DROP FUNCTION "public"."geometry"(bytea);
CREATE FUNCTION "public"."geometry"(bytea)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_from_bytea'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry"("public"."chip")
-- ----------------------------
DROP FUNCTION "public"."geometry"("public"."chip");
CREATE FUNCTION "public"."geometry"("public"."chip")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'CHIP_to_LWGEOM'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry"("public"."chip") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry"("public"."chip") IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry"(text)
-- ----------------------------
DROP FUNCTION "public"."geometry"(text);
CREATE FUNCTION "public"."geometry"(text)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'parse_WKT_lwgeom'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry"("public"."box2d")
-- ----------------------------
DROP FUNCTION "public"."geometry"("public"."box2d");
CREATE FUNCTION "public"."geometry"("public"."box2d")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2DFLOAT4_to_LWGEOM'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry"("public"."box2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry"("public"."box2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry_above"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."geometry_above"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."geometry_above"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_above'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry_above"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry_above"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry_analyze"(internal)
-- ----------------------------
DROP FUNCTION "public"."geometry_analyze"(internal);
CREATE FUNCTION "public"."geometry_analyze"(internal)
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_analyze'
  LANGUAGE 'c' VOLATILE;
ALTER FUNCTION "public"."geometry_analyze"(internal) OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry_analyze"(internal) IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry_below"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."geometry_below"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."geometry_below"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_below'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry_below"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry_below"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry_cmp"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."geometry_cmp"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."geometry_cmp"("public"."geometry", "public"."geometry")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'lwgeom_cmp'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry_cmp"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry_cmp"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry_contain"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."geometry_contain"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."geometry_contain"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_contain'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry_contain"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry_contain"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry_contained"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."geometry_contained"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."geometry_contained"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_contained'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry_contained"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry_contained"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry_eq"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."geometry_eq"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."geometry_eq"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'lwgeom_eq'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry_eq"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry_eq"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry_ge"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."geometry_ge"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."geometry_ge"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'lwgeom_ge'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry_ge"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry_ge"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry_gt"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."geometry_gt"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."geometry_gt"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'lwgeom_gt'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry_gt"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry_gt"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry_in"(cstring)
-- ----------------------------
DROP FUNCTION "public"."geometry_in"(cstring);
CREATE FUNCTION "public"."geometry_in"(cstring)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_in'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry_in"(cstring) OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry_in"(cstring) IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry_le"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."geometry_le"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."geometry_le"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'lwgeom_le'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry_le"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry_le"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry_left"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."geometry_left"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."geometry_left"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_left'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry_left"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry_left"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry_lt"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."geometry_lt"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."geometry_lt"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'lwgeom_lt'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry_lt"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry_lt"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry_out"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."geometry_out"("public"."geometry");
CREATE FUNCTION "public"."geometry_out"("public"."geometry")
  RETURNS cstring AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_out'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry_out"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry_out"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry_overabove"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."geometry_overabove"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."geometry_overabove"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_overabove'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry_overabove"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry_overabove"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry_overbelow"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."geometry_overbelow"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."geometry_overbelow"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_overbelow'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry_overbelow"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry_overbelow"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry_overlap"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."geometry_overlap"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."geometry_overlap"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_overlap'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry_overlap"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry_overlap"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry_overleft"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."geometry_overleft"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."geometry_overleft"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_overleft'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry_overleft"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry_overleft"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry_overright"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."geometry_overright"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."geometry_overright"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_overright'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry_overright"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry_overright"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry_recv"(internal)
-- ----------------------------
DROP FUNCTION "public"."geometry_recv"(internal);
CREATE FUNCTION "public"."geometry_recv"(internal)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_recv'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry_recv"(internal) OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry_recv"(internal) IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry_right"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."geometry_right"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."geometry_right"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_right'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry_right"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry_right"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry_same"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."geometry_same"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."geometry_same"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_same'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry_same"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry_same"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."geometry_send"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."geometry_send"("public"."geometry");
CREATE FUNCTION "public"."geometry_send"("public"."geometry")
  RETURNS bytea AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_send'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometry_send"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometry_send"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."geometryfromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."geometryfromtext"(text, int4);
CREATE FUNCTION "public"."geometryfromtext"(text, int4)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_from_text'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometryfromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometryfromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."geometryfromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."geometryfromtext"(text);
CREATE FUNCTION "public"."geometryfromtext"(text)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_from_text'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometryfromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometryfromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."geometryn"("public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."geometryn"("public"."geometry", int4);
CREATE FUNCTION "public"."geometryn"("public"."geometry", int4)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_geometryn_collection'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometryn"("public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometryn"("public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."geometrytype"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."geometrytype"("public"."geometry");
CREATE FUNCTION "public"."geometrytype"("public"."geometry")
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_getTYPE'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geometrytype"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geometrytype"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."geomfromewkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."geomfromewkb"(bytea);
CREATE FUNCTION "public"."geomfromewkb"(bytea)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOMFromWKB'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geomfromewkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."geomfromewkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."geomfromewkt"(text)
-- ----------------------------
DROP FUNCTION "public"."geomfromewkt"(text);
CREATE FUNCTION "public"."geomfromewkt"(text)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'parse_WKT_lwgeom'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geomfromewkt"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."geomfromewkt"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."geomfromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."geomfromtext"(text);
CREATE FUNCTION "public"."geomfromtext"(text)
  RETURNS geometry AS 
$BODY$SELECT geometryfromtext($1)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."geomfromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."geomfromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."geomfromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."geomfromtext"(text, int4);
CREATE FUNCTION "public"."geomfromtext"(text, int4)
  RETURNS geometry AS 
$BODY$SELECT geometryfromtext($1, $2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."geomfromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."geomfromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."geomfromwkb"(bytea, int4)
-- ----------------------------
DROP FUNCTION "public"."geomfromwkb"(bytea, int4);
CREATE FUNCTION "public"."geomfromwkb"(bytea, int4)
  RETURNS geometry AS 
$BODY$SELECT setSRID(GeomFromWKB($1), $2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."geomfromwkb"(bytea, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."geomfromwkb"(bytea, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."geomfromwkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."geomfromwkb"(bytea);
CREATE FUNCTION "public"."geomfromwkb"(bytea)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_from_WKB'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geomfromwkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."geomfromwkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."geomunion"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."geomunion"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."geomunion"("public"."geometry", "public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'geomunion'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."geomunion"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geomunion"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."geosnoop"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."geosnoop"("public"."geometry");
CREATE FUNCTION "public"."geosnoop"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'GEOSnoop'
  LANGUAGE 'c' VOLATILE;
ALTER FUNCTION "public"."geosnoop"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."geosnoop"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."get_proj4_from_srid"(int4)
-- ----------------------------
DROP FUNCTION "public"."get_proj4_from_srid"(int4);
CREATE FUNCTION "public"."get_proj4_from_srid"(int4)
  RETURNS text AS 
$BODY$
BEGIN
	RETURN proj4text::text FROM spatial_ref_sys WHERE srid= $1;
END;
$BODY$  LANGUAGE 'plpgsql' IMMUTABLE;
ALTER FUNCTION "public"."get_proj4_from_srid"(int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."get_proj4_from_srid"(int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."getbbox"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."getbbox"("public"."geometry");
CREATE FUNCTION "public"."getbbox"("public"."geometry")
  RETURNS box2d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_to_BOX2DFLOAT4'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."getbbox"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."getbbox"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."getsrid"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."getsrid"("public"."geometry");
CREATE FUNCTION "public"."getsrid"("public"."geometry")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_getSRID'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."getsrid"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."getsrid"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."gettransactionid"()
-- ----------------------------
DROP FUNCTION "public"."gettransactionid"();
CREATE FUNCTION "public"."gettransactionid"()
  RETURNS xid AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'getTransactionID'
  LANGUAGE 'c' VOLATILE;
ALTER FUNCTION "public"."gettransactionid"() OWNER TO postgres;
COMMENT ON FUNCTION "public"."gettransactionid"() IS '';
;

-- ----------------------------
-- Function structure for "public"."hasbbox"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."hasbbox"("public"."geometry");
CREATE FUNCTION "public"."hasbbox"("public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_hasBBOX'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."hasbbox"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."hasbbox"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."height"("public"."chip")
-- ----------------------------
DROP FUNCTION "public"."height"("public"."chip");
CREATE FUNCTION "public"."height"("public"."chip")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'CHIP_getHeight'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."height"("public"."chip") OWNER TO postgres;
COMMENT ON FUNCTION "public"."height"("public"."chip") IS '';
;

-- ----------------------------
-- Function structure for "public"."histogram2d_in"(cstring)
-- ----------------------------
DROP FUNCTION "public"."histogram2d_in"(cstring);
CREATE FUNCTION "public"."histogram2d_in"(cstring)
  RETURNS histogram2d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'lwhistogram2d_in'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."histogram2d_in"(cstring) OWNER TO postgres;
COMMENT ON FUNCTION "public"."histogram2d_in"(cstring) IS '';
;

-- ----------------------------
-- Function structure for "public"."histogram2d_out"("public"."histogram2d")
-- ----------------------------
DROP FUNCTION "public"."histogram2d_out"("public"."histogram2d");
CREATE FUNCTION "public"."histogram2d_out"("public"."histogram2d")
  RETURNS cstring AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'lwhistogram2d_out'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."histogram2d_out"("public"."histogram2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."histogram2d_out"("public"."histogram2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."interiorringn"("public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."interiorringn"("public"."geometry", int4);
CREATE FUNCTION "public"."interiorringn"("public"."geometry", int4)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_interiorringn_polygon'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."interiorringn"("public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."interiorringn"("public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."intersection"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."intersection"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."intersection"("public"."geometry", "public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'intersection'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."intersection"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."intersection"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."intersects"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."intersects"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."intersects"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'intersects'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."intersects"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."intersects"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."isclosed"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."isclosed"("public"."geometry");
CREATE FUNCTION "public"."isclosed"("public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_isclosed_linestring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."isclosed"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."isclosed"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."isempty"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."isempty"("public"."geometry");
CREATE FUNCTION "public"."isempty"("public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_isempty'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."isempty"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."isempty"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."isring"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."isring"("public"."geometry");
CREATE FUNCTION "public"."isring"("public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'isring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."isring"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."isring"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."issimple"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."issimple"("public"."geometry");
CREATE FUNCTION "public"."issimple"("public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'issimple'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."issimple"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."issimple"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."isvalid"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."isvalid"("public"."geometry");
CREATE FUNCTION "public"."isvalid"("public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'isvalid'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."isvalid"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."isvalid"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."jtsnoop"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."jtsnoop"("public"."geometry");
CREATE FUNCTION "public"."jtsnoop"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'JTSnoop'
  LANGUAGE 'c' VOLATILE;
ALTER FUNCTION "public"."jtsnoop"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."jtsnoop"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."length"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."length"("public"."geometry");
CREATE FUNCTION "public"."length"("public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_length_linestring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."length"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."length"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."length2d"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."length2d"("public"."geometry");
CREATE FUNCTION "public"."length2d"("public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_length2d_linestring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."length2d"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."length2d"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."length2d_spheroid"("public"."geometry", "public"."spheroid")
-- ----------------------------
DROP FUNCTION "public"."length2d_spheroid"("public"."geometry", "public"."spheroid");
CREATE FUNCTION "public"."length2d_spheroid"("public"."geometry", "public"."spheroid")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_length2d_ellipsoid_linestring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."length2d_spheroid"("public"."geometry", "public"."spheroid") OWNER TO postgres;
COMMENT ON FUNCTION "public"."length2d_spheroid"("public"."geometry", "public"."spheroid") IS '';
;

-- ----------------------------
-- Function structure for "public"."length3d"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."length3d"("public"."geometry");
CREATE FUNCTION "public"."length3d"("public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_length_linestring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."length3d"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."length3d"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."length3d_spheroid"("public"."geometry", "public"."spheroid")
-- ----------------------------
DROP FUNCTION "public"."length3d_spheroid"("public"."geometry", "public"."spheroid");
CREATE FUNCTION "public"."length3d_spheroid"("public"."geometry", "public"."spheroid")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_length_ellipsoid_linestring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."length3d_spheroid"("public"."geometry", "public"."spheroid") OWNER TO postgres;
COMMENT ON FUNCTION "public"."length3d_spheroid"("public"."geometry", "public"."spheroid") IS '';
;

-- ----------------------------
-- Function structure for "public"."length_spheroid"("public"."geometry", "public"."spheroid")
-- ----------------------------
DROP FUNCTION "public"."length_spheroid"("public"."geometry", "public"."spheroid");
CREATE FUNCTION "public"."length_spheroid"("public"."geometry", "public"."spheroid")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_length_ellipsoid_linestring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."length_spheroid"("public"."geometry", "public"."spheroid") OWNER TO postgres;
COMMENT ON FUNCTION "public"."length_spheroid"("public"."geometry", "public"."spheroid") IS '';
;

-- ----------------------------
-- Function structure for "public"."line_interpolate_point"("public"."geometry", float8)
-- ----------------------------
DROP FUNCTION "public"."line_interpolate_point"("public"."geometry", float8);
CREATE FUNCTION "public"."line_interpolate_point"("public"."geometry", float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_line_interpolate_point'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."line_interpolate_point"("public"."geometry", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."line_interpolate_point"("public"."geometry", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."line_locate_point"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."line_locate_point"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."line_locate_point"("public"."geometry", "public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_line_locate_point'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."line_locate_point"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."line_locate_point"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."line_substring"("public"."geometry", float8, float8)
-- ----------------------------
DROP FUNCTION "public"."line_substring"("public"."geometry", float8, float8);
CREATE FUNCTION "public"."line_substring"("public"."geometry", float8, float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_line_substring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."line_substring"("public"."geometry", float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."line_substring"("public"."geometry", float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."linefrommultipoint"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."linefrommultipoint"("public"."geometry");
CREATE FUNCTION "public"."linefrommultipoint"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_line_from_mpoint'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."linefrommultipoint"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."linefrommultipoint"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."linefromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."linefromtext"(text);
CREATE FUNCTION "public"."linefromtext"(text)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'LINESTRING'
	THEN GeomFromText($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."linefromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."linefromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."linefromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."linefromtext"(text, int4);
CREATE FUNCTION "public"."linefromtext"(text, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromText($1, $2)) = 'LINESTRING'
	THEN GeomFromText($1,$2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."linefromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."linefromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."linefromwkb"(bytea, int4)
-- ----------------------------
DROP FUNCTION "public"."linefromwkb"(bytea, int4);
CREATE FUNCTION "public"."linefromwkb"(bytea, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'LINESTRING'
	THEN GeomFromWKB($1, $2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."linefromwkb"(bytea, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."linefromwkb"(bytea, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."linefromwkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."linefromwkb"(bytea);
CREATE FUNCTION "public"."linefromwkb"(bytea)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'LINESTRING'
	THEN GeomFromWKB($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."linefromwkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."linefromwkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."linemerge"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."linemerge"("public"."geometry");
CREATE FUNCTION "public"."linemerge"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'linemerge'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."linemerge"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."linemerge"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."linestringfromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."linestringfromtext"(text, int4);
CREATE FUNCTION "public"."linestringfromtext"(text, int4)
  RETURNS geometry AS 
$BODY$SELECT LineFromText($1, $2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."linestringfromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."linestringfromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."linestringfromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."linestringfromtext"(text);
CREATE FUNCTION "public"."linestringfromtext"(text)
  RETURNS geometry AS 
$BODY$SELECT LineFromText($1)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."linestringfromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."linestringfromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."linestringfromwkb"(bytea, int4)
-- ----------------------------
DROP FUNCTION "public"."linestringfromwkb"(bytea, int4);
CREATE FUNCTION "public"."linestringfromwkb"(bytea, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'LINESTRING'
	THEN GeomFromWKB($1, $2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."linestringfromwkb"(bytea, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."linestringfromwkb"(bytea, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."linestringfromwkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."linestringfromwkb"(bytea);
CREATE FUNCTION "public"."linestringfromwkb"(bytea)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'LINESTRING'
	THEN GeomFromWKB($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."linestringfromwkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."linestringfromwkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."locate_along_measure"("public"."geometry", float8)
-- ----------------------------
DROP FUNCTION "public"."locate_along_measure"("public"."geometry", float8);
CREATE FUNCTION "public"."locate_along_measure"("public"."geometry", float8)
  RETURNS geometry AS 
$BODY$SELECT locate_between_measures($1, $2, $2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."locate_along_measure"("public"."geometry", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."locate_along_measure"("public"."geometry", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."locate_between_measures"("public"."geometry", float8, float8)
-- ----------------------------
DROP FUNCTION "public"."locate_between_measures"("public"."geometry", float8, float8);
CREATE FUNCTION "public"."locate_between_measures"("public"."geometry", float8, float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_locate_between_m'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."locate_between_measures"("public"."geometry", float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."locate_between_measures"("public"."geometry", float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."lockrow"(text, text, text, timestamp)
-- ----------------------------
DROP FUNCTION "public"."lockrow"(text, text, text, timestamp);
CREATE FUNCTION "public"."lockrow"(text, text, text, timestamp)
  RETURNS int4 AS 
$BODY$SELECT LockRow(current_schema(), $1, $2, $3, $4);$BODY$  LANGUAGE 'sql' VOLATILE;
ALTER FUNCTION "public"."lockrow"(text, text, text, timestamp) OWNER TO postgres;
COMMENT ON FUNCTION "public"."lockrow"(text, text, text, timestamp) IS '';
;

-- ----------------------------
-- Function structure for "public"."lockrow"(text, text, text, text, timestamp)
-- ----------------------------
DROP FUNCTION "public"."lockrow"(text, text, text, text, timestamp);
CREATE FUNCTION "public"."lockrow"(text, text, text, text, timestamp)
  RETURNS int4 AS 
$BODY$
DECLARE
	myschema alias for $1;
	mytable alias for $2;
	myrid   alias for $3;
	authid alias for $4;
	expires alias for $5;
	ret int;
	mytoid oid;
	myrec RECORD;
	
BEGIN

	IF NOT LongTransactionsEnabled() THEN
		RAISE EXCEPTION 'Long transaction support disabled, use EnableLongTransaction() to enable.';
	END IF;

	EXECUTE 'DELETE FROM authorization_table WHERE expires < now()'; 

	SELECT c.oid INTO mytoid FROM pg_class c, pg_namespace n
		WHERE c.relname = mytable
		AND c.relnamespace = n.oid
		AND n.nspname = myschema;

	-- RAISE NOTICE 'toid: %', mytoid;

	FOR myrec IN SELECT * FROM authorization_table WHERE 
		toid = mytoid AND rid = myrid
	LOOP
		IF myrec.authid != authid THEN
			RETURN 0;
		ELSE
			RETURN 1;
		END IF;
	END LOOP;

	EXECUTE 'INSERT INTO authorization_table VALUES ('||
		quote_literal(mytoid::text)||','||quote_literal(myrid)||
		','||quote_literal(expires::text)||
		','||quote_literal(authid) ||')';

	GET DIAGNOSTICS ret = ROW_COUNT;

	RETURN ret;
END;$BODY$  LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION "public"."lockrow"(text, text, text, text, timestamp) OWNER TO postgres;
COMMENT ON FUNCTION "public"."lockrow"(text, text, text, text, timestamp) IS '';
;

-- ----------------------------
-- Function structure for "public"."lockrow"(text, text, text)
-- ----------------------------
DROP FUNCTION "public"."lockrow"(text, text, text);
CREATE FUNCTION "public"."lockrow"(text, text, text)
  RETURNS int4 AS 
$BODY$SELECT LockRow(current_schema(), $1, $2, $3, now()::timestamp+'1:00');$BODY$  LANGUAGE 'sql' VOLATILE;
ALTER FUNCTION "public"."lockrow"(text, text, text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."lockrow"(text, text, text) IS '';
;

-- ----------------------------
-- Function structure for "public"."lockrow"(text, text, text, text)
-- ----------------------------
DROP FUNCTION "public"."lockrow"(text, text, text, text);
CREATE FUNCTION "public"."lockrow"(text, text, text, text)
  RETURNS int4 AS 
$BODY$SELECT LockRow($1, $2, $3, $4, now()::timestamp+'1:00');$BODY$  LANGUAGE 'sql' VOLATILE;
ALTER FUNCTION "public"."lockrow"(text, text, text, text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."lockrow"(text, text, text, text) IS '';
;

-- ----------------------------
-- Function structure for "public"."longtransactionsenabled"()
-- ----------------------------
DROP FUNCTION "public"."longtransactionsenabled"();
CREATE FUNCTION "public"."longtransactionsenabled"()
  RETURNS bool AS 
$BODY$
DECLARE
	rec RECORD;
BEGIN
	FOR rec IN SELECT oid FROM pg_class WHERE relname = 'authorized_tables'
	LOOP
		return 't';
	END LOOP;
	return 'f';
END;
$BODY$  LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION "public"."longtransactionsenabled"() OWNER TO postgres;
COMMENT ON FUNCTION "public"."longtransactionsenabled"() IS '';
;

-- ----------------------------
-- Function structure for "public"."lwgeom_gist_compress"(internal)
-- ----------------------------
DROP FUNCTION "public"."lwgeom_gist_compress"(internal);
CREATE FUNCTION "public"."lwgeom_gist_compress"(internal)
  RETURNS internal AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_gist_compress'
  LANGUAGE 'c' VOLATILE;
ALTER FUNCTION "public"."lwgeom_gist_compress"(internal) OWNER TO postgres;
COMMENT ON FUNCTION "public"."lwgeom_gist_compress"(internal) IS '';
;

-- ----------------------------
-- Function structure for "public"."lwgeom_gist_consistent"(internal, "public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."lwgeom_gist_consistent"(internal, "public"."geometry", int4);
CREATE FUNCTION "public"."lwgeom_gist_consistent"(internal, "public"."geometry", int4)
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_gist_consistent'
  LANGUAGE 'c' VOLATILE;
ALTER FUNCTION "public"."lwgeom_gist_consistent"(internal, "public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."lwgeom_gist_consistent"(internal, "public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."lwgeom_gist_decompress"(internal)
-- ----------------------------
DROP FUNCTION "public"."lwgeom_gist_decompress"(internal);
CREATE FUNCTION "public"."lwgeom_gist_decompress"(internal)
  RETURNS internal AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_gist_decompress'
  LANGUAGE 'c' VOLATILE;
ALTER FUNCTION "public"."lwgeom_gist_decompress"(internal) OWNER TO postgres;
COMMENT ON FUNCTION "public"."lwgeom_gist_decompress"(internal) IS '';
;

-- ----------------------------
-- Function structure for "public"."lwgeom_gist_penalty"(internal, internal, internal)
-- ----------------------------
DROP FUNCTION "public"."lwgeom_gist_penalty"(internal, internal, internal);
CREATE FUNCTION "public"."lwgeom_gist_penalty"(internal, internal, internal)
  RETURNS internal AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_gist_penalty'
  LANGUAGE 'c' VOLATILE;
ALTER FUNCTION "public"."lwgeom_gist_penalty"(internal, internal, internal) OWNER TO postgres;
COMMENT ON FUNCTION "public"."lwgeom_gist_penalty"(internal, internal, internal) IS '';
;

-- ----------------------------
-- Function structure for "public"."lwgeom_gist_picksplit"(internal, internal)
-- ----------------------------
DROP FUNCTION "public"."lwgeom_gist_picksplit"(internal, internal);
CREATE FUNCTION "public"."lwgeom_gist_picksplit"(internal, internal)
  RETURNS internal AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_gist_picksplit'
  LANGUAGE 'c' VOLATILE;
ALTER FUNCTION "public"."lwgeom_gist_picksplit"(internal, internal) OWNER TO postgres;
COMMENT ON FUNCTION "public"."lwgeom_gist_picksplit"(internal, internal) IS '';
;

-- ----------------------------
-- Function structure for "public"."lwgeom_gist_same"("public"."box2d", "public"."box2d", internal)
-- ----------------------------
DROP FUNCTION "public"."lwgeom_gist_same"("public"."box2d", "public"."box2d", internal);
CREATE FUNCTION "public"."lwgeom_gist_same"("public"."box2d", "public"."box2d", internal)
  RETURNS internal AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_gist_same'
  LANGUAGE 'c' VOLATILE;
ALTER FUNCTION "public"."lwgeom_gist_same"("public"."box2d", "public"."box2d", internal) OWNER TO postgres;
COMMENT ON FUNCTION "public"."lwgeom_gist_same"("public"."box2d", "public"."box2d", internal) IS '';
;

-- ----------------------------
-- Function structure for "public"."lwgeom_gist_union"(bytea, internal)
-- ----------------------------
DROP FUNCTION "public"."lwgeom_gist_union"(bytea, internal);
CREATE FUNCTION "public"."lwgeom_gist_union"(bytea, internal)
  RETURNS internal AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_gist_union'
  LANGUAGE 'c' VOLATILE;
ALTER FUNCTION "public"."lwgeom_gist_union"(bytea, internal) OWNER TO postgres;
COMMENT ON FUNCTION "public"."lwgeom_gist_union"(bytea, internal) IS '';
;

-- ----------------------------
-- Function structure for "public"."m"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."m"("public"."geometry");
CREATE FUNCTION "public"."m"("public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_m_point'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."m"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."m"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."makebox2d"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."makebox2d"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."makebox2d"("public"."geometry", "public"."geometry")
  RETURNS box2d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2DFLOAT4_construct'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."makebox2d"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."makebox2d"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."makebox3d"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."makebox3d"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."makebox3d"("public"."geometry", "public"."geometry")
  RETURNS box3d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_construct'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."makebox3d"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."makebox3d"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."makeline"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."makeline"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."makeline"("public"."geometry", "public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_makeline'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."makeline"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."makeline"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."makeline_garray"("public"."_geometry")
-- ----------------------------
DROP FUNCTION "public"."makeline_garray"("public"."_geometry");
CREATE FUNCTION "public"."makeline_garray"("public"."_geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_makeline_garray'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."makeline_garray"("public"."_geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."makeline_garray"("public"."_geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."makepoint"(float8, float8, float8)
-- ----------------------------
DROP FUNCTION "public"."makepoint"(float8, float8, float8);
CREATE FUNCTION "public"."makepoint"(float8, float8, float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_makepoint'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."makepoint"(float8, float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."makepoint"(float8, float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."makepoint"(float8, float8)
-- ----------------------------
DROP FUNCTION "public"."makepoint"(float8, float8);
CREATE FUNCTION "public"."makepoint"(float8, float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_makepoint'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."makepoint"(float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."makepoint"(float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."makepoint"(float8, float8, float8, float8)
-- ----------------------------
DROP FUNCTION "public"."makepoint"(float8, float8, float8, float8);
CREATE FUNCTION "public"."makepoint"(float8, float8, float8, float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_makepoint'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."makepoint"(float8, float8, float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."makepoint"(float8, float8, float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."makepointm"(float8, float8, float8)
-- ----------------------------
DROP FUNCTION "public"."makepointm"(float8, float8, float8);
CREATE FUNCTION "public"."makepointm"(float8, float8, float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_makepoint3dm'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."makepointm"(float8, float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."makepointm"(float8, float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."makepolygon"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."makepolygon"("public"."geometry");
CREATE FUNCTION "public"."makepolygon"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_makepoly'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."makepolygon"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."makepolygon"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."makepolygon"("public"."geometry", "public"."_geometry")
-- ----------------------------
DROP FUNCTION "public"."makepolygon"("public"."geometry", "public"."_geometry");
CREATE FUNCTION "public"."makepolygon"("public"."geometry", "public"."_geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_makepoly'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."makepolygon"("public"."geometry", "public"."_geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."makepolygon"("public"."geometry", "public"."_geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."max_distance"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."max_distance"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."max_distance"("public"."geometry", "public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_maxdistance2d_linestring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."max_distance"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."max_distance"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."mem_size"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."mem_size"("public"."geometry");
CREATE FUNCTION "public"."mem_size"("public"."geometry")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_mem_size'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."mem_size"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."mem_size"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."mlinefromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."mlinefromtext"(text, int4);
CREATE FUNCTION "public"."mlinefromtext"(text, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE
	WHEN geometrytype(GeomFromText($1, $2)) = 'MULTILINESTRING'
	THEN GeomFromText($1,$2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."mlinefromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."mlinefromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."mlinefromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."mlinefromtext"(text);
CREATE FUNCTION "public"."mlinefromtext"(text)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'MULTILINESTRING'
	THEN GeomFromText($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."mlinefromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."mlinefromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."mlinefromwkb"(bytea, int4)
-- ----------------------------
DROP FUNCTION "public"."mlinefromwkb"(bytea, int4);
CREATE FUNCTION "public"."mlinefromwkb"(bytea, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'MULTILINESTRING'
	THEN GeomFromWKB($1, $2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."mlinefromwkb"(bytea, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."mlinefromwkb"(bytea, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."mlinefromwkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."mlinefromwkb"(bytea);
CREATE FUNCTION "public"."mlinefromwkb"(bytea)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTILINESTRING'
	THEN GeomFromWKB($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."mlinefromwkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."mlinefromwkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."mpointfromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."mpointfromtext"(text, int4);
CREATE FUNCTION "public"."mpointfromtext"(text, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromText($1,$2)) = 'MULTIPOINT'
	THEN GeomFromText($1,$2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."mpointfromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."mpointfromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."mpointfromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."mpointfromtext"(text);
CREATE FUNCTION "public"."mpointfromtext"(text)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'MULTIPOINT'
	THEN GeomFromText($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."mpointfromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."mpointfromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."mpointfromwkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."mpointfromwkb"(bytea);
CREATE FUNCTION "public"."mpointfromwkb"(bytea)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTIPOINT'
	THEN GeomFromWKB($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."mpointfromwkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."mpointfromwkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."mpointfromwkb"(bytea, int4)
-- ----------------------------
DROP FUNCTION "public"."mpointfromwkb"(bytea, int4);
CREATE FUNCTION "public"."mpointfromwkb"(bytea, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1,$2)) = 'MULTIPOINT'
	THEN GeomFromWKB($1, $2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."mpointfromwkb"(bytea, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."mpointfromwkb"(bytea, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."mpolyfromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."mpolyfromtext"(text);
CREATE FUNCTION "public"."mpolyfromtext"(text)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'MULTIPOLYGON'
	THEN GeomFromText($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."mpolyfromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."mpolyfromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."mpolyfromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."mpolyfromtext"(text, int4);
CREATE FUNCTION "public"."mpolyfromtext"(text, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromText($1, $2)) = 'MULTIPOLYGON'
	THEN GeomFromText($1,$2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."mpolyfromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."mpolyfromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."mpolyfromwkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."mpolyfromwkb"(bytea);
CREATE FUNCTION "public"."mpolyfromwkb"(bytea)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTIPOLYGON'
	THEN GeomFromWKB($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."mpolyfromwkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."mpolyfromwkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."mpolyfromwkb"(bytea, int4)
-- ----------------------------
DROP FUNCTION "public"."mpolyfromwkb"(bytea, int4);
CREATE FUNCTION "public"."mpolyfromwkb"(bytea, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'MULTIPOLYGON'
	THEN GeomFromWKB($1, $2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."mpolyfromwkb"(bytea, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."mpolyfromwkb"(bytea, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."multi"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."multi"("public"."geometry");
CREATE FUNCTION "public"."multi"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_force_multi'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."multi"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."multi"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."multilinefromwkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."multilinefromwkb"(bytea);
CREATE FUNCTION "public"."multilinefromwkb"(bytea)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTILINESTRING'
	THEN GeomFromWKB($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."multilinefromwkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."multilinefromwkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."multilinefromwkb"(bytea, int4)
-- ----------------------------
DROP FUNCTION "public"."multilinefromwkb"(bytea, int4);
CREATE FUNCTION "public"."multilinefromwkb"(bytea, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'MULTILINESTRING'
	THEN GeomFromWKB($1, $2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."multilinefromwkb"(bytea, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."multilinefromwkb"(bytea, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."multilinestringfromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."multilinestringfromtext"(text, int4);
CREATE FUNCTION "public"."multilinestringfromtext"(text, int4)
  RETURNS geometry AS 
$BODY$SELECT MLineFromText($1, $2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."multilinestringfromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."multilinestringfromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."multilinestringfromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."multilinestringfromtext"(text);
CREATE FUNCTION "public"."multilinestringfromtext"(text)
  RETURNS geometry AS 
$BODY$SELECT MLineFromText($1)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."multilinestringfromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."multilinestringfromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."multipointfromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."multipointfromtext"(text);
CREATE FUNCTION "public"."multipointfromtext"(text)
  RETURNS geometry AS 
$BODY$SELECT MPointFromText($1)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."multipointfromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."multipointfromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."multipointfromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."multipointfromtext"(text, int4);
CREATE FUNCTION "public"."multipointfromtext"(text, int4)
  RETURNS geometry AS 
$BODY$SELECT MPointFromText($1, $2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."multipointfromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."multipointfromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."multipointfromwkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."multipointfromwkb"(bytea);
CREATE FUNCTION "public"."multipointfromwkb"(bytea)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTIPOINT'
	THEN GeomFromWKB($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."multipointfromwkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."multipointfromwkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."multipointfromwkb"(bytea, int4)
-- ----------------------------
DROP FUNCTION "public"."multipointfromwkb"(bytea, int4);
CREATE FUNCTION "public"."multipointfromwkb"(bytea, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1,$2)) = 'MULTIPOINT'
	THEN GeomFromWKB($1, $2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."multipointfromwkb"(bytea, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."multipointfromwkb"(bytea, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."multipolyfromwkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."multipolyfromwkb"(bytea);
CREATE FUNCTION "public"."multipolyfromwkb"(bytea)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTIPOLYGON'
	THEN GeomFromWKB($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."multipolyfromwkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."multipolyfromwkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."multipolyfromwkb"(bytea, int4)
-- ----------------------------
DROP FUNCTION "public"."multipolyfromwkb"(bytea, int4);
CREATE FUNCTION "public"."multipolyfromwkb"(bytea, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'MULTIPOLYGON'
	THEN GeomFromWKB($1, $2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."multipolyfromwkb"(bytea, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."multipolyfromwkb"(bytea, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."multipolygonfromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."multipolygonfromtext"(text, int4);
CREATE FUNCTION "public"."multipolygonfromtext"(text, int4)
  RETURNS geometry AS 
$BODY$SELECT MPolyFromText($1, $2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."multipolygonfromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."multipolygonfromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."multipolygonfromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."multipolygonfromtext"(text);
CREATE FUNCTION "public"."multipolygonfromtext"(text)
  RETURNS geometry AS 
$BODY$SELECT MPolyFromText($1)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."multipolygonfromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."multipolygonfromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."ndims"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."ndims"("public"."geometry");
CREATE FUNCTION "public"."ndims"("public"."geometry")
  RETURNS int2 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_ndims'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."ndims"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."ndims"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."noop"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."noop"("public"."geometry");
CREATE FUNCTION "public"."noop"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_noop'
  LANGUAGE 'c' VOLATILE;
ALTER FUNCTION "public"."noop"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."noop"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."npoints"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."npoints"("public"."geometry");
CREATE FUNCTION "public"."npoints"("public"."geometry")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_npoints'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."npoints"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."npoints"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."nrings"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."nrings"("public"."geometry");
CREATE FUNCTION "public"."nrings"("public"."geometry")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_nrings'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."nrings"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."nrings"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."numgeometries"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."numgeometries"("public"."geometry");
CREATE FUNCTION "public"."numgeometries"("public"."geometry")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_numgeometries_collection'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."numgeometries"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."numgeometries"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."numinteriorring"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."numinteriorring"("public"."geometry");
CREATE FUNCTION "public"."numinteriorring"("public"."geometry")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_numinteriorrings_polygon'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."numinteriorring"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."numinteriorring"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."numinteriorrings"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."numinteriorrings"("public"."geometry");
CREATE FUNCTION "public"."numinteriorrings"("public"."geometry")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_numinteriorrings_polygon'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."numinteriorrings"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."numinteriorrings"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."numpoints"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."numpoints"("public"."geometry");
CREATE FUNCTION "public"."numpoints"("public"."geometry")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_numpoints_linestring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."numpoints"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."numpoints"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."overlaps"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."overlaps"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."overlaps"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'overlaps'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."overlaps"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."overlaps"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."perimeter"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."perimeter"("public"."geometry");
CREATE FUNCTION "public"."perimeter"("public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_perimeter_poly'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."perimeter"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."perimeter"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."perimeter2d"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."perimeter2d"("public"."geometry");
CREATE FUNCTION "public"."perimeter2d"("public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_perimeter2d_poly'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."perimeter2d"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."perimeter2d"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."perimeter3d"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."perimeter3d"("public"."geometry");
CREATE FUNCTION "public"."perimeter3d"("public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_perimeter_poly'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."perimeter3d"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."perimeter3d"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."point_inside_circle"("public"."geometry", float8, float8, float8)
-- ----------------------------
DROP FUNCTION "public"."point_inside_circle"("public"."geometry", float8, float8, float8);
CREATE FUNCTION "public"."point_inside_circle"("public"."geometry", float8, float8, float8)
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_inside_circle_point'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."point_inside_circle"("public"."geometry", float8, float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."point_inside_circle"("public"."geometry", float8, float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."pointfromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."pointfromtext"(text);
CREATE FUNCTION "public"."pointfromtext"(text)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'POINT'
	THEN GeomFromText($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."pointfromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."pointfromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."pointfromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."pointfromtext"(text, int4);
CREATE FUNCTION "public"."pointfromtext"(text, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromText($1, $2)) = 'POINT'
	THEN GeomFromText($1,$2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."pointfromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."pointfromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."pointfromwkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."pointfromwkb"(bytea);
CREATE FUNCTION "public"."pointfromwkb"(bytea)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'POINT'
	THEN GeomFromWKB($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."pointfromwkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."pointfromwkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."pointfromwkb"(bytea, int4)
-- ----------------------------
DROP FUNCTION "public"."pointfromwkb"(bytea, int4);
CREATE FUNCTION "public"."pointfromwkb"(bytea, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'POINT'
	THEN GeomFromWKB($1, $2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."pointfromwkb"(bytea, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."pointfromwkb"(bytea, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."pointn"("public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."pointn"("public"."geometry", int4);
CREATE FUNCTION "public"."pointn"("public"."geometry", int4)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_pointn_linestring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."pointn"("public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."pointn"("public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."pointonsurface"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."pointonsurface"("public"."geometry");
CREATE FUNCTION "public"."pointonsurface"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'pointonsurface'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."pointonsurface"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."pointonsurface"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."polyfromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."polyfromtext"(text);
CREATE FUNCTION "public"."polyfromtext"(text)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'POLYGON'
	THEN GeomFromText($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."polyfromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."polyfromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."polyfromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."polyfromtext"(text, int4);
CREATE FUNCTION "public"."polyfromtext"(text, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromText($1, $2)) = 'POLYGON'
	THEN GeomFromText($1,$2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."polyfromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."polyfromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."polyfromwkb"(bytea, int4)
-- ----------------------------
DROP FUNCTION "public"."polyfromwkb"(bytea, int4);
CREATE FUNCTION "public"."polyfromwkb"(bytea, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'POLYGON'
	THEN GeomFromWKB($1, $2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."polyfromwkb"(bytea, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."polyfromwkb"(bytea, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."polyfromwkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."polyfromwkb"(bytea);
CREATE FUNCTION "public"."polyfromwkb"(bytea)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'POLYGON'
	THEN GeomFromWKB($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."polyfromwkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."polyfromwkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."polygonfromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."polygonfromtext"(text, int4);
CREATE FUNCTION "public"."polygonfromtext"(text, int4)
  RETURNS geometry AS 
$BODY$SELECT PolyFromText($1, $2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."polygonfromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."polygonfromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."polygonfromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."polygonfromtext"(text);
CREATE FUNCTION "public"."polygonfromtext"(text)
  RETURNS geometry AS 
$BODY$SELECT PolyFromText($1)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."polygonfromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."polygonfromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."polygonfromwkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."polygonfromwkb"(bytea);
CREATE FUNCTION "public"."polygonfromwkb"(bytea)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'POLYGON'
	THEN GeomFromWKB($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."polygonfromwkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."polygonfromwkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."polygonfromwkb"(bytea, int4)
-- ----------------------------
DROP FUNCTION "public"."polygonfromwkb"(bytea, int4);
CREATE FUNCTION "public"."polygonfromwkb"(bytea, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1,$2)) = 'POLYGON'
	THEN GeomFromWKB($1, $2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."polygonfromwkb"(bytea, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."polygonfromwkb"(bytea, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."polygonize_garray"("public"."_geometry")
-- ----------------------------
DROP FUNCTION "public"."polygonize_garray"("public"."_geometry");
CREATE FUNCTION "public"."polygonize_garray"("public"."_geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'polygonize_garray'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."polygonize_garray"("public"."_geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."polygonize_garray"("public"."_geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."postgis_full_version"()
-- ----------------------------
DROP FUNCTION "public"."postgis_full_version"();
CREATE FUNCTION "public"."postgis_full_version"()
  RETURNS text AS 
$BODY$
DECLARE
	libver text;
	projver text;
	geosver text;
	jtsver text;
	usestats bool;
	dbproc text;
	relproc text;
	fullver text;
BEGIN
	SELECT postgis_lib_version() INTO libver;
	SELECT postgis_proj_version() INTO projver;
	SELECT postgis_geos_version() INTO geosver;
	SELECT postgis_jts_version() INTO jtsver;
	SELECT postgis_uses_stats() INTO usestats;
	SELECT postgis_scripts_installed() INTO dbproc;
	SELECT postgis_scripts_released() INTO relproc;

	fullver = 'POSTGIS="' || libver || '"';

	IF  geosver IS NOT NULL THEN
		fullver = fullver || ' GEOS="' || geosver || '"';
	END IF;

	IF  jtsver IS NOT NULL THEN
		fullver = fullver || ' JTS="' || jtsver || '"';
	END IF;

	IF  projver IS NOT NULL THEN
		fullver = fullver || ' PROJ="' || projver || '"';
	END IF;

	IF usestats THEN
		fullver = fullver || ' USE_STATS';
	END IF;

	-- fullver = fullver || ' DBPROC="' || dbproc || '"';
	-- fullver = fullver || ' RELPROC="' || relproc || '"';

	IF dbproc != relproc THEN
		fullver = fullver || ' (procs from ' || dbproc || ' need upgrade)';
	END IF;

	RETURN fullver;
END
$BODY$  LANGUAGE 'plpgsql' IMMUTABLE;
ALTER FUNCTION "public"."postgis_full_version"() OWNER TO postgres;
COMMENT ON FUNCTION "public"."postgis_full_version"() IS '';
;

-- ----------------------------
-- Function structure for "public"."postgis_geos_version"()
-- ----------------------------
DROP FUNCTION "public"."postgis_geos_version"();
CREATE FUNCTION "public"."postgis_geos_version"()
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'postgis_geos_version'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."postgis_geos_version"() OWNER TO postgres;
COMMENT ON FUNCTION "public"."postgis_geos_version"() IS '';
;

-- ----------------------------
-- Function structure for "public"."postgis_gist_joinsel"(internal, oid, internal, int2)
-- ----------------------------
DROP FUNCTION "public"."postgis_gist_joinsel"(internal, oid, internal, int2);
CREATE FUNCTION "public"."postgis_gist_joinsel"(internal, oid, internal, int2)
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_gist_joinsel'
  LANGUAGE 'c' VOLATILE;
ALTER FUNCTION "public"."postgis_gist_joinsel"(internal, oid, internal, int2) OWNER TO postgres;
COMMENT ON FUNCTION "public"."postgis_gist_joinsel"(internal, oid, internal, int2) IS '';
;

-- ----------------------------
-- Function structure for "public"."postgis_gist_sel"(internal, oid, internal, int4)
-- ----------------------------
DROP FUNCTION "public"."postgis_gist_sel"(internal, oid, internal, int4);
CREATE FUNCTION "public"."postgis_gist_sel"(internal, oid, internal, int4)
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_gist_sel'
  LANGUAGE 'c' VOLATILE;
ALTER FUNCTION "public"."postgis_gist_sel"(internal, oid, internal, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."postgis_gist_sel"(internal, oid, internal, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."postgis_jts_version"()
-- ----------------------------
DROP FUNCTION "public"."postgis_jts_version"();
CREATE FUNCTION "public"."postgis_jts_version"()
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'postgis_jts_version'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."postgis_jts_version"() OWNER TO postgres;
COMMENT ON FUNCTION "public"."postgis_jts_version"() IS '';
;

-- ----------------------------
-- Function structure for "public"."postgis_lib_build_date"()
-- ----------------------------
DROP FUNCTION "public"."postgis_lib_build_date"();
CREATE FUNCTION "public"."postgis_lib_build_date"()
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'postgis_lib_build_date'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."postgis_lib_build_date"() OWNER TO postgres;
COMMENT ON FUNCTION "public"."postgis_lib_build_date"() IS '';
;

-- ----------------------------
-- Function structure for "public"."postgis_lib_version"()
-- ----------------------------
DROP FUNCTION "public"."postgis_lib_version"();
CREATE FUNCTION "public"."postgis_lib_version"()
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'postgis_lib_version'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."postgis_lib_version"() OWNER TO postgres;
COMMENT ON FUNCTION "public"."postgis_lib_version"() IS '';
;

-- ----------------------------
-- Function structure for "public"."postgis_proj_version"()
-- ----------------------------
DROP FUNCTION "public"."postgis_proj_version"();
CREATE FUNCTION "public"."postgis_proj_version"()
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'postgis_proj_version'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."postgis_proj_version"() OWNER TO postgres;
COMMENT ON FUNCTION "public"."postgis_proj_version"() IS '';
;

-- ----------------------------
-- Function structure for "public"."postgis_scripts_build_date"()
-- ----------------------------
DROP FUNCTION "public"."postgis_scripts_build_date"();
CREATE FUNCTION "public"."postgis_scripts_build_date"()
  RETURNS text AS 
$BODY$SELECT '2008-04-22 14:59:00'::text AS version$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."postgis_scripts_build_date"() OWNER TO postgres;
COMMENT ON FUNCTION "public"."postgis_scripts_build_date"() IS '';
;

-- ----------------------------
-- Function structure for "public"."postgis_scripts_installed"()
-- ----------------------------
DROP FUNCTION "public"."postgis_scripts_installed"();
CREATE FUNCTION "public"."postgis_scripts_installed"()
  RETURNS text AS 
$BODY$SELECT '1.3.3'::text AS version$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."postgis_scripts_installed"() OWNER TO postgres;
COMMENT ON FUNCTION "public"."postgis_scripts_installed"() IS '';
;

-- ----------------------------
-- Function structure for "public"."postgis_scripts_released"()
-- ----------------------------
DROP FUNCTION "public"."postgis_scripts_released"();
CREATE FUNCTION "public"."postgis_scripts_released"()
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'postgis_scripts_released'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."postgis_scripts_released"() OWNER TO postgres;
COMMENT ON FUNCTION "public"."postgis_scripts_released"() IS '';
;

-- ----------------------------
-- Function structure for "public"."postgis_uses_stats"()
-- ----------------------------
DROP FUNCTION "public"."postgis_uses_stats"();
CREATE FUNCTION "public"."postgis_uses_stats"()
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'postgis_uses_stats'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."postgis_uses_stats"() OWNER TO postgres;
COMMENT ON FUNCTION "public"."postgis_uses_stats"() IS '';
;

-- ----------------------------
-- Function structure for "public"."postgis_version"()
-- ----------------------------
DROP FUNCTION "public"."postgis_version"();
CREATE FUNCTION "public"."postgis_version"()
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'postgis_version'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."postgis_version"() OWNER TO postgres;
COMMENT ON FUNCTION "public"."postgis_version"() IS '';
;

-- ----------------------------
-- Function structure for "public"."probe_geometry_columns"()
-- ----------------------------
DROP FUNCTION "public"."probe_geometry_columns"();
CREATE FUNCTION "public"."probe_geometry_columns"()
  RETURNS text AS 
$BODY$
DECLARE
	inserted integer;
	oldcount integer;
	probed integer;
	stale integer;
BEGIN

	SELECT count(*) INTO oldcount FROM geometry_columns;

	SELECT count(*) INTO probed
		FROM pg_class c, pg_attribute a, pg_type t, 
			pg_namespace n,
			pg_constraint sridcheck, pg_constraint typecheck

		WHERE t.typname = 'geometry'
		AND a.atttypid = t.oid
		AND a.attrelid = c.oid
		AND c.relnamespace = n.oid
		AND sridcheck.connamespace = n.oid
		AND typecheck.connamespace = n.oid

		AND sridcheck.conrelid = c.oid
		AND sridcheck.consrc LIKE '(srid('||a.attname||') = %)'
		AND typecheck.conrelid = c.oid
		AND typecheck.consrc LIKE
	'((geometrytype('||a.attname||') = ''%''::text) OR (% IS NULL))'
		;

	INSERT INTO geometry_columns SELECT
		''::varchar as f_table_catalogue,
		n.nspname::varchar as f_table_schema,
		c.relname::varchar as f_table_name,
		a.attname::varchar as f_geometry_column,
		2 as coord_dimension,
		trim(both  ' =)' from substr(sridcheck.consrc,
			strpos(sridcheck.consrc, '=')))::integer as srid,
		trim(both ' =)''' from substr(typecheck.consrc, 
			strpos(typecheck.consrc, '='),
			strpos(typecheck.consrc, '::')-
			strpos(typecheck.consrc, '=')
			))::varchar as type

		FROM pg_class c, pg_attribute a, pg_type t, 
			pg_namespace n,
			pg_constraint sridcheck, pg_constraint typecheck
		WHERE t.typname = 'geometry'
		AND a.atttypid = t.oid
		AND a.attrelid = c.oid
		AND c.relnamespace = n.oid
		AND sridcheck.connamespace = n.oid
		AND typecheck.connamespace = n.oid
		AND sridcheck.conrelid = c.oid
		AND sridcheck.consrc LIKE '(srid('||a.attname||') = %)'
		AND typecheck.conrelid = c.oid
		AND typecheck.consrc LIKE
	'((geometrytype('||a.attname||') = ''%''::text) OR (% IS NULL))'

                AND NOT EXISTS (
                        SELECT oid FROM geometry_columns gc
                        WHERE c.relname::varchar = gc.f_table_name
                        AND n.nspname::varchar = gc.f_table_schema
                        AND a.attname::varchar = gc.f_geometry_column
                );

	GET DIAGNOSTICS inserted = ROW_COUNT;

	IF oldcount > probed THEN
		stale = oldcount-probed;
	ELSE
		stale = 0;
	END IF;

        RETURN 'probed:'||probed::text||
		' inserted:'||inserted::text||
		' conflicts:'||(probed-inserted)::text||
		' stale:'||stale::text;
END

$BODY$  LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION "public"."probe_geometry_columns"() OWNER TO postgres;
COMMENT ON FUNCTION "public"."probe_geometry_columns"() IS '';
;

-- ----------------------------
-- Function structure for "public"."relate"("public"."geometry", "public"."geometry", text)
-- ----------------------------
DROP FUNCTION "public"."relate"("public"."geometry", "public"."geometry", text);
CREATE FUNCTION "public"."relate"("public"."geometry", "public"."geometry", text)
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'relate_pattern'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."relate"("public"."geometry", "public"."geometry", text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."relate"("public"."geometry", "public"."geometry", text) IS '';
;

-- ----------------------------
-- Function structure for "public"."relate"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."relate"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."relate"("public"."geometry", "public"."geometry")
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'relate_full'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."relate"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."relate"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."removepoint"("public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."removepoint"("public"."geometry", int4);
CREATE FUNCTION "public"."removepoint"("public"."geometry", int4)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_removepoint'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."removepoint"("public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."removepoint"("public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."rename_geometry_table_constraints"()
-- ----------------------------
DROP FUNCTION "public"."rename_geometry_table_constraints"();
CREATE FUNCTION "public"."rename_geometry_table_constraints"()
  RETURNS text AS 
$BODY$
SELECT 'rename_geometry_table_constraint() is obsoleted'::text
$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."rename_geometry_table_constraints"() OWNER TO postgres;
COMMENT ON FUNCTION "public"."rename_geometry_table_constraints"() IS '';
;

-- ----------------------------
-- Function structure for "public"."reverse"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."reverse"("public"."geometry");
CREATE FUNCTION "public"."reverse"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_reverse'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."reverse"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."reverse"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."rotate"("public"."geometry", float8)
-- ----------------------------
DROP FUNCTION "public"."rotate"("public"."geometry", float8);
CREATE FUNCTION "public"."rotate"("public"."geometry", float8)
  RETURNS geometry AS 
$BODY$SELECT rotateZ($1, $2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."rotate"("public"."geometry", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."rotate"("public"."geometry", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."rotatex"("public"."geometry", float8)
-- ----------------------------
DROP FUNCTION "public"."rotatex"("public"."geometry", float8);
CREATE FUNCTION "public"."rotatex"("public"."geometry", float8)
  RETURNS geometry AS 
$BODY$SELECT affine($1, 1, 0, 0, 0, cos($2), -sin($2), 0, sin($2), cos($2), 0, 0, 0)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."rotatex"("public"."geometry", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."rotatex"("public"."geometry", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."rotatey"("public"."geometry", float8)
-- ----------------------------
DROP FUNCTION "public"."rotatey"("public"."geometry", float8);
CREATE FUNCTION "public"."rotatey"("public"."geometry", float8)
  RETURNS geometry AS 
$BODY$SELECT affine($1,  cos($2), 0, sin($2),  0, 1, 0,  -sin($2), 0, cos($2), 0,  0, 0)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."rotatey"("public"."geometry", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."rotatey"("public"."geometry", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."rotatez"("public"."geometry", float8)
-- ----------------------------
DROP FUNCTION "public"."rotatez"("public"."geometry", float8);
CREATE FUNCTION "public"."rotatez"("public"."geometry", float8)
  RETURNS geometry AS 
$BODY$SELECT affine($1,  cos($2), -sin($2), 0,  sin($2), cos($2), 0,  0, 0, 1,  0, 0, 0)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."rotatez"("public"."geometry", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."rotatez"("public"."geometry", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."scale"("public"."geometry", float8, float8)
-- ----------------------------
DROP FUNCTION "public"."scale"("public"."geometry", float8, float8);
CREATE FUNCTION "public"."scale"("public"."geometry", float8, float8)
  RETURNS geometry AS 
$BODY$SELECT scale($1, $2, $3, 1)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."scale"("public"."geometry", float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."scale"("public"."geometry", float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."scale"("public"."geometry", float8, float8, float8)
-- ----------------------------
DROP FUNCTION "public"."scale"("public"."geometry", float8, float8, float8);
CREATE FUNCTION "public"."scale"("public"."geometry", float8, float8, float8)
  RETURNS geometry AS 
$BODY$SELECT affine($1,  $2, 0, 0,  0, $3, 0,  0, 0, $4,  0, 0, 0)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."scale"("public"."geometry", float8, float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."scale"("public"."geometry", float8, float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."se_envelopesintersect"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."se_envelopesintersect"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."se_envelopesintersect"("public"."geometry", "public"."geometry")
  RETURNS bool AS 
$BODY$
	SELECT $1 && $2
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."se_envelopesintersect"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."se_envelopesintersect"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."se_is3d"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."se_is3d"("public"."geometry");
CREATE FUNCTION "public"."se_is3d"("public"."geometry")
  RETURNS bool AS 
$BODY$
    SELECT CASE ST_zmflag($1)
               WHEN 0 THEN false
               WHEN 1 THEN false
               WHEN 2 THEN true
               WHEN 3 THEN true
               ELSE false
           END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."se_is3d"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."se_is3d"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."se_ismeasured"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."se_ismeasured"("public"."geometry");
CREATE FUNCTION "public"."se_ismeasured"("public"."geometry")
  RETURNS bool AS 
$BODY$
    SELECT CASE ST_zmflag($1)
               WHEN 0 THEN false
               WHEN 1 THEN true
               WHEN 2 THEN false
               WHEN 3 THEN true
               ELSE false
           END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."se_ismeasured"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."se_ismeasured"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."se_locatealong"("public"."geometry", float8)
-- ----------------------------
DROP FUNCTION "public"."se_locatealong"("public"."geometry", float8);
CREATE FUNCTION "public"."se_locatealong"("public"."geometry", float8)
  RETURNS geometry AS 
$BODY$SELECT locate_between_measures($1, $2, $2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."se_locatealong"("public"."geometry", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."se_locatealong"("public"."geometry", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."se_locatebetween"("public"."geometry", float8, float8)
-- ----------------------------
DROP FUNCTION "public"."se_locatebetween"("public"."geometry", float8, float8);
CREATE FUNCTION "public"."se_locatebetween"("public"."geometry", float8, float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_locate_between_m'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."se_locatebetween"("public"."geometry", float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."se_locatebetween"("public"."geometry", float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."se_m"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."se_m"("public"."geometry");
CREATE FUNCTION "public"."se_m"("public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_m_point'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."se_m"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."se_m"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."se_z"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."se_z"("public"."geometry");
CREATE FUNCTION "public"."se_z"("public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_z_point'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."se_z"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."se_z"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."segmentize"("public"."geometry", float8)
-- ----------------------------
DROP FUNCTION "public"."segmentize"("public"."geometry", float8);
CREATE FUNCTION "public"."segmentize"("public"."geometry", float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_segmentize2d'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."segmentize"("public"."geometry", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."segmentize"("public"."geometry", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."setfactor"("public"."chip", float4)
-- ----------------------------
DROP FUNCTION "public"."setfactor"("public"."chip", float4);
CREATE FUNCTION "public"."setfactor"("public"."chip", float4)
  RETURNS chip AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'CHIP_setFactor'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."setfactor"("public"."chip", float4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."setfactor"("public"."chip", float4) IS '';
;

-- ----------------------------
-- Function structure for "public"."setpoint"("public"."geometry", int4, "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."setpoint"("public"."geometry", int4, "public"."geometry");
CREATE FUNCTION "public"."setpoint"("public"."geometry", int4, "public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_setpoint_linestring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."setpoint"("public"."geometry", int4, "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."setpoint"("public"."geometry", int4, "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."setsrid"("public"."chip", int4)
-- ----------------------------
DROP FUNCTION "public"."setsrid"("public"."chip", int4);
CREATE FUNCTION "public"."setsrid"("public"."chip", int4)
  RETURNS chip AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'CHIP_setSRID'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."setsrid"("public"."chip", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."setsrid"("public"."chip", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."setsrid"("public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."setsrid"("public"."geometry", int4);
CREATE FUNCTION "public"."setsrid"("public"."geometry", int4)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_setSRID'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."setsrid"("public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."setsrid"("public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."shift_longitude"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."shift_longitude"("public"."geometry");
CREATE FUNCTION "public"."shift_longitude"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_longitude_shift'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."shift_longitude"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."shift_longitude"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."simplify"("public"."geometry", float8)
-- ----------------------------
DROP FUNCTION "public"."simplify"("public"."geometry", float8);
CREATE FUNCTION "public"."simplify"("public"."geometry", float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_simplify2d'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."simplify"("public"."geometry", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."simplify"("public"."geometry", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."snaptogrid"("public"."geometry", "public"."geometry", float8, float8, float8, float8)
-- ----------------------------
DROP FUNCTION "public"."snaptogrid"("public"."geometry", "public"."geometry", float8, float8, float8, float8);
CREATE FUNCTION "public"."snaptogrid"("public"."geometry", "public"."geometry", float8, float8, float8, float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_snaptogrid_pointoff'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."snaptogrid"("public"."geometry", "public"."geometry", float8, float8, float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."snaptogrid"("public"."geometry", "public"."geometry", float8, float8, float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."snaptogrid"("public"."geometry", float8)
-- ----------------------------
DROP FUNCTION "public"."snaptogrid"("public"."geometry", float8);
CREATE FUNCTION "public"."snaptogrid"("public"."geometry", float8)
  RETURNS geometry AS 
$BODY$SELECT SnapToGrid($1, 0, 0, $2, $2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."snaptogrid"("public"."geometry", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."snaptogrid"("public"."geometry", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."snaptogrid"("public"."geometry", float8, float8)
-- ----------------------------
DROP FUNCTION "public"."snaptogrid"("public"."geometry", float8, float8);
CREATE FUNCTION "public"."snaptogrid"("public"."geometry", float8, float8)
  RETURNS geometry AS 
$BODY$SELECT SnapToGrid($1, 0, 0, $2, $3)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."snaptogrid"("public"."geometry", float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."snaptogrid"("public"."geometry", float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."snaptogrid"("public"."geometry", float8, float8, float8, float8)
-- ----------------------------
DROP FUNCTION "public"."snaptogrid"("public"."geometry", float8, float8, float8, float8);
CREATE FUNCTION "public"."snaptogrid"("public"."geometry", float8, float8, float8, float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_snaptogrid'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."snaptogrid"("public"."geometry", float8, float8, float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."snaptogrid"("public"."geometry", float8, float8, float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."spheroid_in"(cstring)
-- ----------------------------
DROP FUNCTION "public"."spheroid_in"(cstring);
CREATE FUNCTION "public"."spheroid_in"(cstring)
  RETURNS spheroid AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'ellipsoid_in'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."spheroid_in"(cstring) OWNER TO postgres;
COMMENT ON FUNCTION "public"."spheroid_in"(cstring) IS '';
;

-- ----------------------------
-- Function structure for "public"."spheroid_out"("public"."spheroid")
-- ----------------------------
DROP FUNCTION "public"."spheroid_out"("public"."spheroid");
CREATE FUNCTION "public"."spheroid_out"("public"."spheroid")
  RETURNS cstring AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'ellipsoid_out'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."spheroid_out"("public"."spheroid") OWNER TO postgres;
COMMENT ON FUNCTION "public"."spheroid_out"("public"."spheroid") IS '';
;

-- ----------------------------
-- Function structure for "public"."srid"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."srid"("public"."geometry");
CREATE FUNCTION "public"."srid"("public"."geometry")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_getSRID'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."srid"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."srid"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."srid"("public"."chip")
-- ----------------------------
DROP FUNCTION "public"."srid"("public"."chip");
CREATE FUNCTION "public"."srid"("public"."chip")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'CHIP_getSRID'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."srid"("public"."chip") OWNER TO postgres;
COMMENT ON FUNCTION "public"."srid"("public"."chip") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_addbbox"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_addbbox"("public"."geometry");
CREATE FUNCTION "public"."st_addbbox"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_addBBOX'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_addbbox"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_addbbox"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_addpoint"("public"."geometry", "public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."st_addpoint"("public"."geometry", "public"."geometry", int4);
CREATE FUNCTION "public"."st_addpoint"("public"."geometry", "public"."geometry", int4)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_addpoint'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_addpoint"("public"."geometry", "public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_addpoint"("public"."geometry", "public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_addpoint"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_addpoint"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_addpoint"("public"."geometry", "public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_addpoint'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_addpoint"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_addpoint"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_affine"("public"."geometry", float8, float8, float8, float8, float8, float8)
-- ----------------------------
DROP FUNCTION "public"."st_affine"("public"."geometry", float8, float8, float8, float8, float8, float8);
CREATE FUNCTION "public"."st_affine"("public"."geometry", float8, float8, float8, float8, float8, float8)
  RETURNS geometry AS 
$BODY$SELECT affine($1,  $2, $3, 0,  $4, $5, 0,  0, 0, 1,  $6, $7, 0)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_affine"("public"."geometry", float8, float8, float8, float8, float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_affine"("public"."geometry", float8, float8, float8, float8, float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_affine"("public"."geometry", float8, float8, float8, float8, float8, float8, float8, float8, float8, float8, float8, float8)
-- ----------------------------
DROP FUNCTION "public"."st_affine"("public"."geometry", float8, float8, float8, float8, float8, float8, float8, float8, float8, float8, float8, float8);
CREATE FUNCTION "public"."st_affine"("public"."geometry", float8, float8, float8, float8, float8, float8, float8, float8, float8, float8, float8, float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_affine'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_affine"("public"."geometry", float8, float8, float8, float8, float8, float8, float8, float8, float8, float8, float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_affine"("public"."geometry", float8, float8, float8, float8, float8, float8, float8, float8, float8, float8, float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_area"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_area"("public"."geometry");
CREATE FUNCTION "public"."st_area"("public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_area_polygon'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_area"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_area"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_area2d"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_area2d"("public"."geometry");
CREATE FUNCTION "public"."st_area2d"("public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_area_polygon'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_area2d"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_area2d"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_asbinary"("public"."geometry", text)
-- ----------------------------
DROP FUNCTION "public"."st_asbinary"("public"."geometry", text);
CREATE FUNCTION "public"."st_asbinary"("public"."geometry", text)
  RETURNS bytea AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_asBinary'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_asbinary"("public"."geometry", text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_asbinary"("public"."geometry", text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_asbinary"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_asbinary"("public"."geometry");
CREATE FUNCTION "public"."st_asbinary"("public"."geometry")
  RETURNS bytea AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_asBinary'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_asbinary"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_asbinary"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_asewkb"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_asewkb"("public"."geometry");
CREATE FUNCTION "public"."st_asewkb"("public"."geometry")
  RETURNS bytea AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'WKBFromLWGEOM'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_asewkb"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_asewkb"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_asewkb"("public"."geometry", text)
-- ----------------------------
DROP FUNCTION "public"."st_asewkb"("public"."geometry", text);
CREATE FUNCTION "public"."st_asewkb"("public"."geometry", text)
  RETURNS bytea AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'WKBFromLWGEOM'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_asewkb"("public"."geometry", text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_asewkb"("public"."geometry", text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_asewkt"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_asewkt"("public"."geometry");
CREATE FUNCTION "public"."st_asewkt"("public"."geometry")
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_asEWKT'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_asewkt"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_asewkt"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_asgml"(int4, "public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."st_asgml"(int4, "public"."geometry", int4);
CREATE FUNCTION "public"."st_asgml"(int4, "public"."geometry", int4)
  RETURNS text AS 
$BODY$SELECT _ST_AsGML($1, $2, $3)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_asgml"(int4, "public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_asgml"(int4, "public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_asgml"(int4, "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_asgml"(int4, "public"."geometry");
CREATE FUNCTION "public"."st_asgml"(int4, "public"."geometry")
  RETURNS text AS 
$BODY$SELECT _ST_AsGML($1, $2, 15)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_asgml"(int4, "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_asgml"(int4, "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_asgml"("public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."st_asgml"("public"."geometry", int4);
CREATE FUNCTION "public"."st_asgml"("public"."geometry", int4)
  RETURNS text AS 
$BODY$SELECT _ST_AsGML(2, $1, $2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_asgml"("public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_asgml"("public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_asgml"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_asgml"("public"."geometry");
CREATE FUNCTION "public"."st_asgml"("public"."geometry")
  RETURNS text AS 
$BODY$SELECT _ST_AsGML(2, $1, 15)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_asgml"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_asgml"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_ashexewkb"("public"."geometry", text)
-- ----------------------------
DROP FUNCTION "public"."st_ashexewkb"("public"."geometry", text);
CREATE FUNCTION "public"."st_ashexewkb"("public"."geometry", text)
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_asHEXEWKB'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_ashexewkb"("public"."geometry", text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_ashexewkb"("public"."geometry", text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_ashexewkb"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_ashexewkb"("public"."geometry");
CREATE FUNCTION "public"."st_ashexewkb"("public"."geometry")
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_asHEXEWKB'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_ashexewkb"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_ashexewkb"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_askml"(int4, "public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."st_askml"(int4, "public"."geometry", int4);
CREATE FUNCTION "public"."st_askml"(int4, "public"."geometry", int4)
  RETURNS text AS 
$BODY$SELECT _ST_AsKML($1, transform($2,4326), $3)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_askml"(int4, "public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_askml"(int4, "public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_askml"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_askml"("public"."geometry");
CREATE FUNCTION "public"."st_askml"("public"."geometry")
  RETURNS text AS 
$BODY$SELECT _ST_AsKML(2, transform($1,4326), 15)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_askml"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_askml"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_askml"(int4, "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_askml"(int4, "public"."geometry");
CREATE FUNCTION "public"."st_askml"(int4, "public"."geometry")
  RETURNS text AS 
$BODY$SELECT _ST_AsKML($1, transform($2,4326), 15)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_askml"(int4, "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_askml"(int4, "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_askml"("public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."st_askml"("public"."geometry", int4);
CREATE FUNCTION "public"."st_askml"("public"."geometry", int4)
  RETURNS text AS 
$BODY$SELECT _ST_AsKML(2, transform($1,4326), $2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_askml"("public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_askml"("public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_assvg"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_assvg"("public"."geometry");
CREATE FUNCTION "public"."st_assvg"("public"."geometry")
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'assvg_geometry'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_assvg"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_assvg"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_assvg"("public"."geometry", int4, int4)
-- ----------------------------
DROP FUNCTION "public"."st_assvg"("public"."geometry", int4, int4);
CREATE FUNCTION "public"."st_assvg"("public"."geometry", int4, int4)
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'assvg_geometry'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_assvg"("public"."geometry", int4, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_assvg"("public"."geometry", int4, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_assvg"("public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."st_assvg"("public"."geometry", int4);
CREATE FUNCTION "public"."st_assvg"("public"."geometry", int4)
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'assvg_geometry'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_assvg"("public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_assvg"("public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_astext"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_astext"("public"."geometry");
CREATE FUNCTION "public"."st_astext"("public"."geometry")
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_asText'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_astext"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_astext"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_azimuth"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_azimuth"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_azimuth"("public"."geometry", "public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_azimuth'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_azimuth"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_azimuth"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_bdmpolyfromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."st_bdmpolyfromtext"(text, int4);
CREATE FUNCTION "public"."st_bdmpolyfromtext"(text, int4)
  RETURNS geometry AS 
$BODY$
DECLARE
	geomtext alias for $1;
	srid alias for $2;
	mline geometry;
	geom geometry;
BEGIN
	mline := MultiLineStringFromText(geomtext, srid);

	IF mline IS NULL
	THEN
		RAISE EXCEPTION 'Input is not a MultiLinestring';
	END IF;

	geom := multi(BuildArea(mline));

	RETURN geom;
END;
$BODY$  LANGUAGE 'plpgsql' IMMUTABLE;
ALTER FUNCTION "public"."st_bdmpolyfromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_bdmpolyfromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_bdpolyfromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."st_bdpolyfromtext"(text, int4);
CREATE FUNCTION "public"."st_bdpolyfromtext"(text, int4)
  RETURNS geometry AS 
$BODY$
DECLARE
	geomtext alias for $1;
	srid alias for $2;
	mline geometry;
	geom geometry;
BEGIN
	mline := MultiLineStringFromText(geomtext, srid);

	IF mline IS NULL
	THEN
		RAISE EXCEPTION 'Input is not a MultiLinestring';
	END IF;

	geom := BuildArea(mline);

	IF GeometryType(geom) != 'POLYGON'
	THEN
		RAISE EXCEPTION 'Input returns more then a single polygon, try using BdMPolyFromText instead';
	END IF;

	RETURN geom;
END;
$BODY$  LANGUAGE 'plpgsql' IMMUTABLE;
ALTER FUNCTION "public"."st_bdpolyfromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_bdpolyfromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_boundary"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_boundary"("public"."geometry");
CREATE FUNCTION "public"."st_boundary"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'boundary'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_boundary"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_boundary"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_box"("public"."box3d")
-- ----------------------------
DROP FUNCTION "public"."st_box"("public"."box3d");
CREATE FUNCTION "public"."st_box"("public"."box3d")
  RETURNS box AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_to_BOX'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_box"("public"."box3d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_box"("public"."box3d") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_box"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_box"("public"."geometry");
CREATE FUNCTION "public"."st_box"("public"."geometry")
  RETURNS box AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_to_BOX'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_box"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_box"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_box2d"("public"."box3d")
-- ----------------------------
DROP FUNCTION "public"."st_box2d"("public"."box3d");
CREATE FUNCTION "public"."st_box2d"("public"."box3d")
  RETURNS box2d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_to_BOX2DFLOAT4'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_box2d"("public"."box3d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_box2d"("public"."box3d") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_box2d"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_box2d"("public"."geometry");
CREATE FUNCTION "public"."st_box2d"("public"."geometry")
  RETURNS box2d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_to_BOX2DFLOAT4'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_box2d"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_box2d"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_box2d_contain"("public"."box2d", "public"."box2d")
-- ----------------------------
DROP FUNCTION "public"."st_box2d_contain"("public"."box2d", "public"."box2d");
CREATE FUNCTION "public"."st_box2d_contain"("public"."box2d", "public"."box2d")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2D_contain'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_box2d_contain"("public"."box2d", "public"."box2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_box2d_contain"("public"."box2d", "public"."box2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_box2d_contained"("public"."box2d", "public"."box2d")
-- ----------------------------
DROP FUNCTION "public"."st_box2d_contained"("public"."box2d", "public"."box2d");
CREATE FUNCTION "public"."st_box2d_contained"("public"."box2d", "public"."box2d")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2D_contained'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_box2d_contained"("public"."box2d", "public"."box2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_box2d_contained"("public"."box2d", "public"."box2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_box2d_in"(cstring)
-- ----------------------------
DROP FUNCTION "public"."st_box2d_in"(cstring);
CREATE FUNCTION "public"."st_box2d_in"(cstring)
  RETURNS box2d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2DFLOAT4_in'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_box2d_in"(cstring) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_box2d_in"(cstring) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_box2d_intersects"("public"."box2d", "public"."box2d")
-- ----------------------------
DROP FUNCTION "public"."st_box2d_intersects"("public"."box2d", "public"."box2d");
CREATE FUNCTION "public"."st_box2d_intersects"("public"."box2d", "public"."box2d")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2D_intersects'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_box2d_intersects"("public"."box2d", "public"."box2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_box2d_intersects"("public"."box2d", "public"."box2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_box2d_left"("public"."box2d", "public"."box2d")
-- ----------------------------
DROP FUNCTION "public"."st_box2d_left"("public"."box2d", "public"."box2d");
CREATE FUNCTION "public"."st_box2d_left"("public"."box2d", "public"."box2d")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2D_left'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_box2d_left"("public"."box2d", "public"."box2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_box2d_left"("public"."box2d", "public"."box2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_box2d_out"("public"."box2d")
-- ----------------------------
DROP FUNCTION "public"."st_box2d_out"("public"."box2d");
CREATE FUNCTION "public"."st_box2d_out"("public"."box2d")
  RETURNS cstring AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2DFLOAT4_out'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_box2d_out"("public"."box2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_box2d_out"("public"."box2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_box2d_overlap"("public"."box2d", "public"."box2d")
-- ----------------------------
DROP FUNCTION "public"."st_box2d_overlap"("public"."box2d", "public"."box2d");
CREATE FUNCTION "public"."st_box2d_overlap"("public"."box2d", "public"."box2d")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2D_overlap'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_box2d_overlap"("public"."box2d", "public"."box2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_box2d_overlap"("public"."box2d", "public"."box2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_box2d_overleft"("public"."box2d", "public"."box2d")
-- ----------------------------
DROP FUNCTION "public"."st_box2d_overleft"("public"."box2d", "public"."box2d");
CREATE FUNCTION "public"."st_box2d_overleft"("public"."box2d", "public"."box2d")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2D_overleft'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_box2d_overleft"("public"."box2d", "public"."box2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_box2d_overleft"("public"."box2d", "public"."box2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_box2d_overright"("public"."box2d", "public"."box2d")
-- ----------------------------
DROP FUNCTION "public"."st_box2d_overright"("public"."box2d", "public"."box2d");
CREATE FUNCTION "public"."st_box2d_overright"("public"."box2d", "public"."box2d")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2D_overright'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_box2d_overright"("public"."box2d", "public"."box2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_box2d_overright"("public"."box2d", "public"."box2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_box2d_right"("public"."box2d", "public"."box2d")
-- ----------------------------
DROP FUNCTION "public"."st_box2d_right"("public"."box2d", "public"."box2d");
CREATE FUNCTION "public"."st_box2d_right"("public"."box2d", "public"."box2d")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2D_right'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_box2d_right"("public"."box2d", "public"."box2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_box2d_right"("public"."box2d", "public"."box2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_box2d_same"("public"."box2d", "public"."box2d")
-- ----------------------------
DROP FUNCTION "public"."st_box2d_same"("public"."box2d", "public"."box2d");
CREATE FUNCTION "public"."st_box2d_same"("public"."box2d", "public"."box2d")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2D_same'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_box2d_same"("public"."box2d", "public"."box2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_box2d_same"("public"."box2d", "public"."box2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_box3d"("public"."box2d")
-- ----------------------------
DROP FUNCTION "public"."st_box3d"("public"."box2d");
CREATE FUNCTION "public"."st_box3d"("public"."box2d")
  RETURNS box3d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2DFLOAT4_to_BOX3D'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_box3d"("public"."box2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_box3d"("public"."box2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_box3d"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_box3d"("public"."geometry");
CREATE FUNCTION "public"."st_box3d"("public"."geometry")
  RETURNS box3d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_to_BOX3D'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_box3d"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_box3d"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_box3d_in"(cstring)
-- ----------------------------
DROP FUNCTION "public"."st_box3d_in"(cstring);
CREATE FUNCTION "public"."st_box3d_in"(cstring)
  RETURNS box3d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_in'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_box3d_in"(cstring) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_box3d_in"(cstring) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_box3d_out"("public"."box3d")
-- ----------------------------
DROP FUNCTION "public"."st_box3d_out"("public"."box3d");
CREATE FUNCTION "public"."st_box3d_out"("public"."box3d")
  RETURNS cstring AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_out'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_box3d_out"("public"."box3d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_box3d_out"("public"."box3d") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_buffer"("public"."geometry", float8)
-- ----------------------------
DROP FUNCTION "public"."st_buffer"("public"."geometry", float8);
CREATE FUNCTION "public"."st_buffer"("public"."geometry", float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'buffer'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_buffer"("public"."geometry", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_buffer"("public"."geometry", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_buffer"("public"."geometry", float8, int4)
-- ----------------------------
DROP FUNCTION "public"."st_buffer"("public"."geometry", float8, int4);
CREATE FUNCTION "public"."st_buffer"("public"."geometry", float8, int4)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'buffer'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_buffer"("public"."geometry", float8, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_buffer"("public"."geometry", float8, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_build_histogram2d"("public"."histogram2d", text, text, text)
-- ----------------------------
DROP FUNCTION "public"."st_build_histogram2d"("public"."histogram2d", text, text, text);
CREATE FUNCTION "public"."st_build_histogram2d"("public"."histogram2d", text, text, text)
  RETURNS histogram2d AS 
$BODY$
BEGIN
	EXECUTE 'SET local search_path = '||$2||',public';
	RETURN public.build_histogram2d($1,$3,$4);
END
$BODY$  LANGUAGE 'plpgsql' STABLE;
ALTER FUNCTION "public"."st_build_histogram2d"("public"."histogram2d", text, text, text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_build_histogram2d"("public"."histogram2d", text, text, text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_build_histogram2d"("public"."histogram2d", text, text)
-- ----------------------------
DROP FUNCTION "public"."st_build_histogram2d"("public"."histogram2d", text, text);
CREATE FUNCTION "public"."st_build_histogram2d"("public"."histogram2d", text, text)
  RETURNS histogram2d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'build_lwhistogram2d'
  LANGUAGE 'c' STABLE;
ALTER FUNCTION "public"."st_build_histogram2d"("public"."histogram2d", text, text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_build_histogram2d"("public"."histogram2d", text, text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_buildarea"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_buildarea"("public"."geometry");
CREATE FUNCTION "public"."st_buildarea"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_buildarea'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_buildarea"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_buildarea"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_bytea"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_bytea"("public"."geometry");
CREATE FUNCTION "public"."st_bytea"("public"."geometry")
  RETURNS bytea AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_to_bytea'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_bytea"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_bytea"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_cache_bbox"()
-- ----------------------------
DROP FUNCTION "public"."st_cache_bbox"();
CREATE FUNCTION "public"."st_cache_bbox"()
  RETURNS trigger AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'cache_bbox'
  LANGUAGE 'c' VOLATILE;
ALTER FUNCTION "public"."st_cache_bbox"() OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_cache_bbox"() IS '';
;

-- ----------------------------
-- Function structure for "public"."st_centroid"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_centroid"("public"."geometry");
CREATE FUNCTION "public"."st_centroid"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'centroid'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_centroid"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_centroid"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_chip_in"(cstring)
-- ----------------------------
DROP FUNCTION "public"."st_chip_in"(cstring);
CREATE FUNCTION "public"."st_chip_in"(cstring)
  RETURNS chip AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'CHIP_in'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_chip_in"(cstring) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_chip_in"(cstring) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_chip_out"("public"."chip")
-- ----------------------------
DROP FUNCTION "public"."st_chip_out"("public"."chip");
CREATE FUNCTION "public"."st_chip_out"("public"."chip")
  RETURNS cstring AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'CHIP_out'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_chip_out"("public"."chip") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_chip_out"("public"."chip") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_collect"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_collect"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_collect"("public"."geometry", "public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_collect'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_collect"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_collect"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_collect_garray"("public"."_geometry")
-- ----------------------------
DROP FUNCTION "public"."st_collect_garray"("public"."_geometry");
CREATE FUNCTION "public"."st_collect_garray"("public"."_geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_collect_garray'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_collect_garray"("public"."_geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_collect_garray"("public"."_geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_collector"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_collector"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_collector"("public"."geometry", "public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_collect'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_collector"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_collector"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_combine_bbox"("public"."box2d", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_combine_bbox"("public"."box2d", "public"."geometry");
CREATE FUNCTION "public"."st_combine_bbox"("public"."box2d", "public"."geometry")
  RETURNS box2d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2DFLOAT4_combine'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_combine_bbox"("public"."box2d", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_combine_bbox"("public"."box2d", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_combine_bbox"("public"."box3d", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_combine_bbox"("public"."box3d", "public"."geometry");
CREATE FUNCTION "public"."st_combine_bbox"("public"."box3d", "public"."geometry")
  RETURNS box3d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_combine'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_combine_bbox"("public"."box3d", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_combine_bbox"("public"."box3d", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_compression"("public"."chip")
-- ----------------------------
DROP FUNCTION "public"."st_compression"("public"."chip");
CREATE FUNCTION "public"."st_compression"("public"."chip")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'CHIP_getCompression'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_compression"("public"."chip") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_compression"("public"."chip") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_contains"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_contains"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_contains"("public"."geometry", "public"."geometry")
  RETURNS bool AS 
$BODY$SELECT $1 && $2 AND _ST_Contains($1,$2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_contains"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_contains"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_convexhull"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_convexhull"("public"."geometry");
CREATE FUNCTION "public"."st_convexhull"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'convexhull'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_convexhull"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_convexhull"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_coorddim"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_coorddim"("public"."geometry");
CREATE FUNCTION "public"."st_coorddim"("public"."geometry")
  RETURNS int2 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_ndims'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_coorddim"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_coorddim"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_create_histogram2d"("public"."box2d", int4)
-- ----------------------------
DROP FUNCTION "public"."st_create_histogram2d"("public"."box2d", int4);
CREATE FUNCTION "public"."st_create_histogram2d"("public"."box2d", int4)
  RETURNS histogram2d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'create_lwhistogram2d'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_create_histogram2d"("public"."box2d", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_create_histogram2d"("public"."box2d", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_crosses"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_crosses"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_crosses"("public"."geometry", "public"."geometry")
  RETURNS bool AS 
$BODY$SELECT $1 && $2 AND _ST_Crosses($1,$2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_crosses"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_crosses"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_curvetoline"("public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."st_curvetoline"("public"."geometry", int4);
CREATE FUNCTION "public"."st_curvetoline"("public"."geometry", int4)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_curve_segmentize'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_curvetoline"("public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_curvetoline"("public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_curvetoline"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_curvetoline"("public"."geometry");
CREATE FUNCTION "public"."st_curvetoline"("public"."geometry")
  RETURNS geometry AS 
$BODY$SELECT ST_CurveToLine($1, 32)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_curvetoline"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_curvetoline"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_datatype"("public"."chip")
-- ----------------------------
DROP FUNCTION "public"."st_datatype"("public"."chip");
CREATE FUNCTION "public"."st_datatype"("public"."chip")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'CHIP_getDatatype'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_datatype"("public"."chip") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_datatype"("public"."chip") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_difference"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_difference"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_difference"("public"."geometry", "public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'difference'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_difference"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_difference"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_dimension"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_dimension"("public"."geometry");
CREATE FUNCTION "public"."st_dimension"("public"."geometry")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_dimension'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_dimension"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_dimension"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_disjoint"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_disjoint"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_disjoint"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'disjoint'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_disjoint"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_disjoint"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_distance"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_distance"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_distance"("public"."geometry", "public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_mindistance2d'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_distance"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_distance"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_distance_sphere"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_distance_sphere"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_distance_sphere"("public"."geometry", "public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_distance_sphere'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_distance_sphere"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_distance_sphere"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_distance_spheroid"("public"."geometry", "public"."geometry", "public"."spheroid")
-- ----------------------------
DROP FUNCTION "public"."st_distance_spheroid"("public"."geometry", "public"."geometry", "public"."spheroid");
CREATE FUNCTION "public"."st_distance_spheroid"("public"."geometry", "public"."geometry", "public"."spheroid")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_distance_ellipsoid_point'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_distance_spheroid"("public"."geometry", "public"."geometry", "public"."spheroid") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_distance_spheroid"("public"."geometry", "public"."geometry", "public"."spheroid") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_dropbbox"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_dropbbox"("public"."geometry");
CREATE FUNCTION "public"."st_dropbbox"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_dropBBOX'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_dropbbox"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_dropbbox"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_dump"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_dump"("public"."geometry");
CREATE FUNCTION "public"."st_dump"("public"."geometry")
  RETURNS geometry_dump AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_dump'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_dump"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_dump"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_dumprings"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_dumprings"("public"."geometry");
CREATE FUNCTION "public"."st_dumprings"("public"."geometry")
  RETURNS geometry_dump AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_dump_rings'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_dumprings"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_dumprings"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_dwithin"("public"."geometry", "public"."geometry", float8)
-- ----------------------------
DROP FUNCTION "public"."st_dwithin"("public"."geometry", "public"."geometry", float8);
CREATE FUNCTION "public"."st_dwithin"("public"."geometry", "public"."geometry", float8)
  RETURNS bool AS 
$BODY$SELECT $1 && ST_Expand($2,$3) AND $2 && ST_Expand($1,$3) AND ST_Distance($1, $2) < $3$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_dwithin"("public"."geometry", "public"."geometry", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_dwithin"("public"."geometry", "public"."geometry", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_endpoint"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_endpoint"("public"."geometry");
CREATE FUNCTION "public"."st_endpoint"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_endpoint_linestring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_endpoint"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_endpoint"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_envelope"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_envelope"("public"."geometry");
CREATE FUNCTION "public"."st_envelope"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_envelope'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_envelope"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_envelope"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_equals"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_equals"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_equals"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'geomequals'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_equals"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_equals"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_estimate_histogram2d"("public"."histogram2d", "public"."box2d")
-- ----------------------------
DROP FUNCTION "public"."st_estimate_histogram2d"("public"."histogram2d", "public"."box2d");
CREATE FUNCTION "public"."st_estimate_histogram2d"("public"."histogram2d", "public"."box2d")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'estimate_lwhistogram2d'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_estimate_histogram2d"("public"."histogram2d", "public"."box2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_estimate_histogram2d"("public"."histogram2d", "public"."box2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_estimated_extent"(text, text, text)
-- ----------------------------
DROP FUNCTION "public"."st_estimated_extent"(text, text, text);
CREATE FUNCTION "public"."st_estimated_extent"(text, text, text)
  RETURNS box2d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_estimated_extent'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_estimated_extent"(text, text, text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_estimated_extent"(text, text, text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_estimated_extent"(text, text)
-- ----------------------------
DROP FUNCTION "public"."st_estimated_extent"(text, text);
CREATE FUNCTION "public"."st_estimated_extent"(text, text)
  RETURNS box2d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_estimated_extent'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_estimated_extent"(text, text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_estimated_extent"(text, text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_expand"("public"."box3d", float8)
-- ----------------------------
DROP FUNCTION "public"."st_expand"("public"."box3d", float8);
CREATE FUNCTION "public"."st_expand"("public"."box3d", float8)
  RETURNS box3d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_expand'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_expand"("public"."box3d", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_expand"("public"."box3d", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_expand"("public"."box2d", float8)
-- ----------------------------
DROP FUNCTION "public"."st_expand"("public"."box2d", float8);
CREATE FUNCTION "public"."st_expand"("public"."box2d", float8)
  RETURNS box2d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2DFLOAT4_expand'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_expand"("public"."box2d", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_expand"("public"."box2d", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_expand"("public"."geometry", float8)
-- ----------------------------
DROP FUNCTION "public"."st_expand"("public"."geometry", float8);
CREATE FUNCTION "public"."st_expand"("public"."geometry", float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_expand'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_expand"("public"."geometry", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_expand"("public"."geometry", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_explode_histogram2d"("public"."histogram2d", text)
-- ----------------------------
DROP FUNCTION "public"."st_explode_histogram2d"("public"."histogram2d", text);
CREATE FUNCTION "public"."st_explode_histogram2d"("public"."histogram2d", text)
  RETURNS histogram2d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'explode_lwhistogram2d'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_explode_histogram2d"("public"."histogram2d", text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_explode_histogram2d"("public"."histogram2d", text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_exteriorring"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_exteriorring"("public"."geometry");
CREATE FUNCTION "public"."st_exteriorring"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_exteriorring_polygon'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_exteriorring"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_exteriorring"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_factor"("public"."chip")
-- ----------------------------
DROP FUNCTION "public"."st_factor"("public"."chip");
CREATE FUNCTION "public"."st_factor"("public"."chip")
  RETURNS float4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'CHIP_getFactor'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_factor"("public"."chip") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_factor"("public"."chip") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_find_extent"(text, text, text)
-- ----------------------------
DROP FUNCTION "public"."st_find_extent"(text, text, text);
CREATE FUNCTION "public"."st_find_extent"(text, text, text)
  RETURNS box2d AS 
$BODY$
DECLARE
	schemaname alias for $1;
	tablename alias for $2;
	columnname alias for $3;
	myrec RECORD;

BEGIN
	FOR myrec IN EXECUTE 'SELECT extent("'||columnname||'") FROM "'||schemaname||'"."'||tablename||'"' LOOP
		return myrec.extent;
	END LOOP; 
END;
$BODY$  LANGUAGE 'plpgsql' IMMUTABLE;
ALTER FUNCTION "public"."st_find_extent"(text, text, text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_find_extent"(text, text, text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_find_extent"(text, text)
-- ----------------------------
DROP FUNCTION "public"."st_find_extent"(text, text);
CREATE FUNCTION "public"."st_find_extent"(text, text)
  RETURNS box2d AS 
$BODY$
DECLARE
	tablename alias for $1;
	columnname alias for $2;
	myrec RECORD;

BEGIN
	FOR myrec IN EXECUTE 'SELECT extent("'||columnname||'") FROM "'||tablename||'"' LOOP
		return myrec.extent;
	END LOOP; 
END;
$BODY$  LANGUAGE 'plpgsql' IMMUTABLE;
ALTER FUNCTION "public"."st_find_extent"(text, text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_find_extent"(text, text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_force_2d"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_force_2d"("public"."geometry");
CREATE FUNCTION "public"."st_force_2d"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_force_2d'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_force_2d"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_force_2d"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_force_3d"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_force_3d"("public"."geometry");
CREATE FUNCTION "public"."st_force_3d"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_force_3dz'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_force_3d"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_force_3d"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_force_3dm"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_force_3dm"("public"."geometry");
CREATE FUNCTION "public"."st_force_3dm"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_force_3dm'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_force_3dm"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_force_3dm"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_force_3dz"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_force_3dz"("public"."geometry");
CREATE FUNCTION "public"."st_force_3dz"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_force_3dz'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_force_3dz"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_force_3dz"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_force_4d"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_force_4d"("public"."geometry");
CREATE FUNCTION "public"."st_force_4d"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_force_4d'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_force_4d"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_force_4d"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_force_collection"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_force_collection"("public"."geometry");
CREATE FUNCTION "public"."st_force_collection"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_force_collection'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_force_collection"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_force_collection"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_forcerhr"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_forcerhr"("public"."geometry");
CREATE FUNCTION "public"."st_forcerhr"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_forceRHR_poly'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_forcerhr"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_forcerhr"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geom_accum"("public"."_geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_geom_accum"("public"."_geometry", "public"."geometry");
CREATE FUNCTION "public"."st_geom_accum"("public"."_geometry", "public"."geometry")
  RETURNS _geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_accum'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geom_accum"("public"."_geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geom_accum"("public"."_geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geomcollfromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."st_geomcollfromtext"(text);
CREATE FUNCTION "public"."st_geomcollfromtext"(text)
  RETURNS geometry AS 
$BODY$
	SELECT CASE
	WHEN geometrytype(GeomFromText($1)) = 'GEOMETRYCOLLECTION'
	THEN GeomFromText($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_geomcollfromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geomcollfromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geomcollfromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."st_geomcollfromtext"(text, int4);
CREATE FUNCTION "public"."st_geomcollfromtext"(text, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE
	WHEN geometrytype(GeomFromText($1, $2)) = 'GEOMETRYCOLLECTION'
	THEN GeomFromText($1,$2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_geomcollfromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geomcollfromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geomcollfromwkb"(bytea, int4)
-- ----------------------------
DROP FUNCTION "public"."st_geomcollfromwkb"(bytea, int4);
CREATE FUNCTION "public"."st_geomcollfromwkb"(bytea, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE
	WHEN geometrytype(GeomFromWKB($1, $2)) = 'GEOMETRYCOLLECTION'
	THEN GeomFromWKB($1, $2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_geomcollfromwkb"(bytea, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geomcollfromwkb"(bytea, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geomcollfromwkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."st_geomcollfromwkb"(bytea);
CREATE FUNCTION "public"."st_geomcollfromwkb"(bytea)
  RETURNS geometry AS 
$BODY$
	SELECT CASE
	WHEN geometrytype(GeomFromWKB($1)) = 'GEOMETRYCOLLECTION'
	THEN GeomFromWKB($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_geomcollfromwkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geomcollfromwkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry"(text)
-- ----------------------------
DROP FUNCTION "public"."st_geometry"(text);
CREATE FUNCTION "public"."st_geometry"(text)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'parse_WKT_lwgeom'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry"(bytea)
-- ----------------------------
DROP FUNCTION "public"."st_geometry"(bytea);
CREATE FUNCTION "public"."st_geometry"(bytea)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_from_bytea'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry"("public"."chip")
-- ----------------------------
DROP FUNCTION "public"."st_geometry"("public"."chip");
CREATE FUNCTION "public"."st_geometry"("public"."chip")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'CHIP_to_LWGEOM'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry"("public"."chip") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry"("public"."chip") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry"("public"."box3d")
-- ----------------------------
DROP FUNCTION "public"."st_geometry"("public"."box3d");
CREATE FUNCTION "public"."st_geometry"("public"."box3d")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_to_LWGEOM'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry"("public"."box3d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry"("public"."box3d") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry"("public"."box2d")
-- ----------------------------
DROP FUNCTION "public"."st_geometry"("public"."box2d");
CREATE FUNCTION "public"."st_geometry"("public"."box2d")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2DFLOAT4_to_LWGEOM'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry"("public"."box2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry"("public"."box2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry_above"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_geometry_above"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_geometry_above"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_above'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry_above"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry_above"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry_analyze"(internal)
-- ----------------------------
DROP FUNCTION "public"."st_geometry_analyze"(internal);
CREATE FUNCTION "public"."st_geometry_analyze"(internal)
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_analyze'
  LANGUAGE 'c' VOLATILE;
ALTER FUNCTION "public"."st_geometry_analyze"(internal) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry_analyze"(internal) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry_below"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_geometry_below"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_geometry_below"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_below'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry_below"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry_below"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry_cmp"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_geometry_cmp"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_geometry_cmp"("public"."geometry", "public"."geometry")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'lwgeom_cmp'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry_cmp"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry_cmp"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry_contain"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_geometry_contain"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_geometry_contain"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_contain'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry_contain"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry_contain"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry_contained"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_geometry_contained"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_geometry_contained"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_contained'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry_contained"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry_contained"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry_eq"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_geometry_eq"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_geometry_eq"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'lwgeom_eq'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry_eq"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry_eq"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry_ge"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_geometry_ge"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_geometry_ge"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'lwgeom_ge'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry_ge"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry_ge"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry_gt"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_geometry_gt"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_geometry_gt"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'lwgeom_gt'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry_gt"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry_gt"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry_in"(cstring)
-- ----------------------------
DROP FUNCTION "public"."st_geometry_in"(cstring);
CREATE FUNCTION "public"."st_geometry_in"(cstring)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_in'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry_in"(cstring) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry_in"(cstring) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry_le"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_geometry_le"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_geometry_le"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'lwgeom_le'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry_le"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry_le"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry_left"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_geometry_left"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_geometry_left"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_left'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry_left"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry_left"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry_lt"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_geometry_lt"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_geometry_lt"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'lwgeom_lt'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry_lt"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry_lt"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry_out"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_geometry_out"("public"."geometry");
CREATE FUNCTION "public"."st_geometry_out"("public"."geometry")
  RETURNS cstring AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_out'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry_out"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry_out"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry_overabove"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_geometry_overabove"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_geometry_overabove"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_overabove'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry_overabove"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry_overabove"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry_overbelow"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_geometry_overbelow"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_geometry_overbelow"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_overbelow'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry_overbelow"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry_overbelow"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry_overlap"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_geometry_overlap"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_geometry_overlap"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_overlap'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry_overlap"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry_overlap"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry_overleft"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_geometry_overleft"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_geometry_overleft"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_overleft'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry_overleft"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry_overleft"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry_overright"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_geometry_overright"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_geometry_overright"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_overright'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry_overright"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry_overright"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry_recv"(internal)
-- ----------------------------
DROP FUNCTION "public"."st_geometry_recv"(internal);
CREATE FUNCTION "public"."st_geometry_recv"(internal)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_recv'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry_recv"(internal) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry_recv"(internal) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry_right"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_geometry_right"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_geometry_right"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_right'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry_right"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry_right"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry_same"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_geometry_same"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_geometry_same"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_same'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry_same"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry_same"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometry_send"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_geometry_send"("public"."geometry");
CREATE FUNCTION "public"."st_geometry_send"("public"."geometry")
  RETURNS bytea AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_send'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometry_send"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometry_send"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometryfromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."st_geometryfromtext"(text, int4);
CREATE FUNCTION "public"."st_geometryfromtext"(text, int4)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_from_text'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometryfromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometryfromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometryfromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."st_geometryfromtext"(text);
CREATE FUNCTION "public"."st_geometryfromtext"(text)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_from_text'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometryfromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometryfromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometryn"("public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."st_geometryn"("public"."geometry", int4);
CREATE FUNCTION "public"."st_geometryn"("public"."geometry", int4)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_geometryn_collection'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geometryn"("public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometryn"("public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geometrytype"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_geometrytype"("public"."geometry");
CREATE FUNCTION "public"."st_geometrytype"("public"."geometry")
  RETURNS text AS 
$BODY$
    DECLARE
        gtype text := geometrytype($1);
    BEGIN
        IF (gtype IN ('POINT', 'POINTM')) THEN
            gtype := 'Point';
        ELSIF (gtype IN ('LINESTRING', 'LINESTRINGM')) THEN
            gtype := 'LineString';
        ELSIF (gtype IN ('POLYGON', 'POLYGONM')) THEN
            gtype := 'Polygon';
        ELSIF (gtype IN ('MULTIPOINT', 'MULTIPOINTM')) THEN
            gtype := 'MultiPoint';
        ELSIF (gtype IN ('MULTILINESTRING', 'MULTILINESTRINGM')) THEN
            gtype := 'MultiLineString';
        ELSIF (gtype IN ('MULTIPOLYGON', 'MULTIPOLYGONM')) THEN
            gtype := 'MultiPolygon';
        ELSE
            gtype := 'Geometry';
        END IF;
        RETURN 'ST_' || gtype;
    END
	$BODY$  LANGUAGE 'plpgsql' IMMUTABLE;
ALTER FUNCTION "public"."st_geometrytype"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geometrytype"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geomfromewkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."st_geomfromewkb"(bytea);
CREATE FUNCTION "public"."st_geomfromewkb"(bytea)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOMFromWKB'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geomfromewkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geomfromewkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geomfromewkt"(text)
-- ----------------------------
DROP FUNCTION "public"."st_geomfromewkt"(text);
CREATE FUNCTION "public"."st_geomfromewkt"(text)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'parse_WKT_lwgeom'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geomfromewkt"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geomfromewkt"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geomfromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."st_geomfromtext"(text, int4);
CREATE FUNCTION "public"."st_geomfromtext"(text, int4)
  RETURNS geometry AS 
$BODY$SELECT geometryfromtext($1, $2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_geomfromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geomfromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geomfromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."st_geomfromtext"(text);
CREATE FUNCTION "public"."st_geomfromtext"(text)
  RETURNS geometry AS 
$BODY$SELECT geometryfromtext($1)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_geomfromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geomfromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geomfromwkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."st_geomfromwkb"(bytea);
CREATE FUNCTION "public"."st_geomfromwkb"(bytea)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_from_WKB'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_geomfromwkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geomfromwkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_geomfromwkb"(bytea, int4)
-- ----------------------------
DROP FUNCTION "public"."st_geomfromwkb"(bytea, int4);
CREATE FUNCTION "public"."st_geomfromwkb"(bytea, int4)
  RETURNS geometry AS 
$BODY$SELECT setSRID(GeomFromWKB($1), $2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_geomfromwkb"(bytea, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_geomfromwkb"(bytea, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_hasarc"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_hasarc"("public"."geometry");
CREATE FUNCTION "public"."st_hasarc"("public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_has_arc'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_hasarc"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_hasarc"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_hasbbox"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_hasbbox"("public"."geometry");
CREATE FUNCTION "public"."st_hasbbox"("public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_hasBBOX'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_hasbbox"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_hasbbox"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_height"("public"."chip")
-- ----------------------------
DROP FUNCTION "public"."st_height"("public"."chip");
CREATE FUNCTION "public"."st_height"("public"."chip")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'CHIP_getHeight'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_height"("public"."chip") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_height"("public"."chip") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_histogram2d_in"(cstring)
-- ----------------------------
DROP FUNCTION "public"."st_histogram2d_in"(cstring);
CREATE FUNCTION "public"."st_histogram2d_in"(cstring)
  RETURNS histogram2d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'lwhistogram2d_in'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_histogram2d_in"(cstring) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_histogram2d_in"(cstring) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_histogram2d_out"("public"."histogram2d")
-- ----------------------------
DROP FUNCTION "public"."st_histogram2d_out"("public"."histogram2d");
CREATE FUNCTION "public"."st_histogram2d_out"("public"."histogram2d")
  RETURNS cstring AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'lwhistogram2d_out'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_histogram2d_out"("public"."histogram2d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_histogram2d_out"("public"."histogram2d") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_interiorringn"("public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."st_interiorringn"("public"."geometry", int4);
CREATE FUNCTION "public"."st_interiorringn"("public"."geometry", int4)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_interiorringn_polygon'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_interiorringn"("public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_interiorringn"("public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_intersection"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_intersection"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_intersection"("public"."geometry", "public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'intersection'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_intersection"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_intersection"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_intersects"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_intersects"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_intersects"("public"."geometry", "public"."geometry")
  RETURNS bool AS 
$BODY$SELECT $1 && $2 AND _ST_Intersects($1,$2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_intersects"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_intersects"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_isclosed"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_isclosed"("public"."geometry");
CREATE FUNCTION "public"."st_isclosed"("public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_isclosed_linestring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_isclosed"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_isclosed"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_isempty"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_isempty"("public"."geometry");
CREATE FUNCTION "public"."st_isempty"("public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_isempty'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_isempty"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_isempty"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_isring"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_isring"("public"."geometry");
CREATE FUNCTION "public"."st_isring"("public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'isring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_isring"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_isring"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_issimple"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_issimple"("public"."geometry");
CREATE FUNCTION "public"."st_issimple"("public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'issimple'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_issimple"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_issimple"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_isvalid"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_isvalid"("public"."geometry");
CREATE FUNCTION "public"."st_isvalid"("public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'isvalid'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_isvalid"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_isvalid"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_length"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_length"("public"."geometry");
CREATE FUNCTION "public"."st_length"("public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_length2d_linestring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_length"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_length"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_length2d"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_length2d"("public"."geometry");
CREATE FUNCTION "public"."st_length2d"("public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_length2d_linestring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_length2d"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_length2d"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_length2d_spheroid"("public"."geometry", "public"."spheroid")
-- ----------------------------
DROP FUNCTION "public"."st_length2d_spheroid"("public"."geometry", "public"."spheroid");
CREATE FUNCTION "public"."st_length2d_spheroid"("public"."geometry", "public"."spheroid")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_length2d_ellipsoid_linestring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_length2d_spheroid"("public"."geometry", "public"."spheroid") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_length2d_spheroid"("public"."geometry", "public"."spheroid") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_length3d"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_length3d"("public"."geometry");
CREATE FUNCTION "public"."st_length3d"("public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_length_linestring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_length3d"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_length3d"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_length3d_spheroid"("public"."geometry", "public"."spheroid")
-- ----------------------------
DROP FUNCTION "public"."st_length3d_spheroid"("public"."geometry", "public"."spheroid");
CREATE FUNCTION "public"."st_length3d_spheroid"("public"."geometry", "public"."spheroid")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_length_ellipsoid_linestring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_length3d_spheroid"("public"."geometry", "public"."spheroid") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_length3d_spheroid"("public"."geometry", "public"."spheroid") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_length_spheroid"("public"."geometry", "public"."spheroid")
-- ----------------------------
DROP FUNCTION "public"."st_length_spheroid"("public"."geometry", "public"."spheroid");
CREATE FUNCTION "public"."st_length_spheroid"("public"."geometry", "public"."spheroid")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_length_ellipsoid_linestring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_length_spheroid"("public"."geometry", "public"."spheroid") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_length_spheroid"("public"."geometry", "public"."spheroid") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_line_interpolate_point"("public"."geometry", float8)
-- ----------------------------
DROP FUNCTION "public"."st_line_interpolate_point"("public"."geometry", float8);
CREATE FUNCTION "public"."st_line_interpolate_point"("public"."geometry", float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_line_interpolate_point'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_line_interpolate_point"("public"."geometry", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_line_interpolate_point"("public"."geometry", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_line_locate_point"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_line_locate_point"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_line_locate_point"("public"."geometry", "public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_line_locate_point'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_line_locate_point"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_line_locate_point"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_line_substring"("public"."geometry", float8, float8)
-- ----------------------------
DROP FUNCTION "public"."st_line_substring"("public"."geometry", float8, float8);
CREATE FUNCTION "public"."st_line_substring"("public"."geometry", float8, float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_line_substring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_line_substring"("public"."geometry", float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_line_substring"("public"."geometry", float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_linefrommultipoint"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_linefrommultipoint"("public"."geometry");
CREATE FUNCTION "public"."st_linefrommultipoint"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_line_from_mpoint'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_linefrommultipoint"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_linefrommultipoint"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_linefromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."st_linefromtext"(text);
CREATE FUNCTION "public"."st_linefromtext"(text)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'LINESTRING'
	THEN GeomFromText($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_linefromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_linefromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_linefromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."st_linefromtext"(text, int4);
CREATE FUNCTION "public"."st_linefromtext"(text, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromText($1, $2)) = 'LINESTRING'
	THEN GeomFromText($1,$2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_linefromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_linefromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_linefromwkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."st_linefromwkb"(bytea);
CREATE FUNCTION "public"."st_linefromwkb"(bytea)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'LINESTRING'
	THEN GeomFromWKB($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_linefromwkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_linefromwkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_linefromwkb"(bytea, int4)
-- ----------------------------
DROP FUNCTION "public"."st_linefromwkb"(bytea, int4);
CREATE FUNCTION "public"."st_linefromwkb"(bytea, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'LINESTRING'
	THEN GeomFromWKB($1, $2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_linefromwkb"(bytea, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_linefromwkb"(bytea, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_linemerge"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_linemerge"("public"."geometry");
CREATE FUNCTION "public"."st_linemerge"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'linemerge'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_linemerge"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_linemerge"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_linestringfromwkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."st_linestringfromwkb"(bytea);
CREATE FUNCTION "public"."st_linestringfromwkb"(bytea)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'LINESTRING'
	THEN GeomFromWKB($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_linestringfromwkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_linestringfromwkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_linestringfromwkb"(bytea, int4)
-- ----------------------------
DROP FUNCTION "public"."st_linestringfromwkb"(bytea, int4);
CREATE FUNCTION "public"."st_linestringfromwkb"(bytea, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'LINESTRING'
	THEN GeomFromWKB($1, $2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_linestringfromwkb"(bytea, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_linestringfromwkb"(bytea, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_linetocurve"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_linetocurve"("public"."geometry");
CREATE FUNCTION "public"."st_linetocurve"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_line_desegmentize'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_linetocurve"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_linetocurve"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_locate_along_measure"("public"."geometry", float8)
-- ----------------------------
DROP FUNCTION "public"."st_locate_along_measure"("public"."geometry", float8);
CREATE FUNCTION "public"."st_locate_along_measure"("public"."geometry", float8)
  RETURNS geometry AS 
$BODY$SELECT locate_between_measures($1, $2, $2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_locate_along_measure"("public"."geometry", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_locate_along_measure"("public"."geometry", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_locate_between_measures"("public"."geometry", float8, float8)
-- ----------------------------
DROP FUNCTION "public"."st_locate_between_measures"("public"."geometry", float8, float8);
CREATE FUNCTION "public"."st_locate_between_measures"("public"."geometry", float8, float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_locate_between_m'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_locate_between_measures"("public"."geometry", float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_locate_between_measures"("public"."geometry", float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_m"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_m"("public"."geometry");
CREATE FUNCTION "public"."st_m"("public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_m_point'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_m"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_m"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_makebox2d"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_makebox2d"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_makebox2d"("public"."geometry", "public"."geometry")
  RETURNS box2d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX2DFLOAT4_construct'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_makebox2d"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_makebox2d"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_makebox3d"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_makebox3d"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_makebox3d"("public"."geometry", "public"."geometry")
  RETURNS box3d AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_construct'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_makebox3d"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_makebox3d"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_makeline"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_makeline"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_makeline"("public"."geometry", "public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_makeline'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_makeline"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_makeline"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_makeline_garray"("public"."_geometry")
-- ----------------------------
DROP FUNCTION "public"."st_makeline_garray"("public"."_geometry");
CREATE FUNCTION "public"."st_makeline_garray"("public"."_geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_makeline_garray'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_makeline_garray"("public"."_geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_makeline_garray"("public"."_geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_makepoint"(float8, float8, float8)
-- ----------------------------
DROP FUNCTION "public"."st_makepoint"(float8, float8, float8);
CREATE FUNCTION "public"."st_makepoint"(float8, float8, float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_makepoint'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_makepoint"(float8, float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_makepoint"(float8, float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_makepoint"(float8, float8, float8, float8)
-- ----------------------------
DROP FUNCTION "public"."st_makepoint"(float8, float8, float8, float8);
CREATE FUNCTION "public"."st_makepoint"(float8, float8, float8, float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_makepoint'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_makepoint"(float8, float8, float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_makepoint"(float8, float8, float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_makepoint"(float8, float8)
-- ----------------------------
DROP FUNCTION "public"."st_makepoint"(float8, float8);
CREATE FUNCTION "public"."st_makepoint"(float8, float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_makepoint'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_makepoint"(float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_makepoint"(float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_makepolygon"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_makepolygon"("public"."geometry");
CREATE FUNCTION "public"."st_makepolygon"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_makepoly'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_makepolygon"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_makepolygon"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_makepolygon"("public"."geometry", "public"."_geometry")
-- ----------------------------
DROP FUNCTION "public"."st_makepolygon"("public"."geometry", "public"."_geometry");
CREATE FUNCTION "public"."st_makepolygon"("public"."geometry", "public"."_geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_makepoly'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_makepolygon"("public"."geometry", "public"."_geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_makepolygon"("public"."geometry", "public"."_geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_max_distance"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_max_distance"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_max_distance"("public"."geometry", "public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_maxdistance2d_linestring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_max_distance"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_max_distance"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_mem_size"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_mem_size"("public"."geometry");
CREATE FUNCTION "public"."st_mem_size"("public"."geometry")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_mem_size'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_mem_size"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_mem_size"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_mlinefromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."st_mlinefromtext"(text);
CREATE FUNCTION "public"."st_mlinefromtext"(text)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'MULTILINESTRING'
	THEN GeomFromText($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_mlinefromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_mlinefromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_mlinefromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."st_mlinefromtext"(text, int4);
CREATE FUNCTION "public"."st_mlinefromtext"(text, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE
	WHEN geometrytype(GeomFromText($1, $2)) = 'MULTILINESTRING'
	THEN GeomFromText($1,$2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_mlinefromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_mlinefromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_mlinefromwkb"(bytea, int4)
-- ----------------------------
DROP FUNCTION "public"."st_mlinefromwkb"(bytea, int4);
CREATE FUNCTION "public"."st_mlinefromwkb"(bytea, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'MULTILINESTRING'
	THEN GeomFromWKB($1, $2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_mlinefromwkb"(bytea, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_mlinefromwkb"(bytea, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_mlinefromwkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."st_mlinefromwkb"(bytea);
CREATE FUNCTION "public"."st_mlinefromwkb"(bytea)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTILINESTRING'
	THEN GeomFromWKB($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_mlinefromwkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_mlinefromwkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_mpointfromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."st_mpointfromtext"(text, int4);
CREATE FUNCTION "public"."st_mpointfromtext"(text, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromText($1, $2)) = 'MULTIPOINT'
	THEN GeomFromText($1, $2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_mpointfromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_mpointfromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_mpointfromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."st_mpointfromtext"(text);
CREATE FUNCTION "public"."st_mpointfromtext"(text)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'MULTIPOINT'
	THEN GeomFromText($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_mpointfromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_mpointfromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_mpointfromwkb"(bytea, int4)
-- ----------------------------
DROP FUNCTION "public"."st_mpointfromwkb"(bytea, int4);
CREATE FUNCTION "public"."st_mpointfromwkb"(bytea, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'MULTIPOINT'
	THEN GeomFromWKB($1, $2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_mpointfromwkb"(bytea, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_mpointfromwkb"(bytea, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_mpointfromwkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."st_mpointfromwkb"(bytea);
CREATE FUNCTION "public"."st_mpointfromwkb"(bytea)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTIPOINT'
	THEN GeomFromWKB($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_mpointfromwkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_mpointfromwkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_mpolyfromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."st_mpolyfromtext"(text);
CREATE FUNCTION "public"."st_mpolyfromtext"(text)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'MULTIPOLYGON'
	THEN GeomFromText($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_mpolyfromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_mpolyfromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_mpolyfromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."st_mpolyfromtext"(text, int4);
CREATE FUNCTION "public"."st_mpolyfromtext"(text, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromText($1, $2)) = 'MULTIPOLYGON'
	THEN GeomFromText($1,$2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_mpolyfromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_mpolyfromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_mpolyfromwkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."st_mpolyfromwkb"(bytea);
CREATE FUNCTION "public"."st_mpolyfromwkb"(bytea)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTIPOLYGON'
	THEN GeomFromWKB($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_mpolyfromwkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_mpolyfromwkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_mpolyfromwkb"(bytea, int4)
-- ----------------------------
DROP FUNCTION "public"."st_mpolyfromwkb"(bytea, int4);
CREATE FUNCTION "public"."st_mpolyfromwkb"(bytea, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'MULTIPOLYGON'
	THEN GeomFromWKB($1, $2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_mpolyfromwkb"(bytea, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_mpolyfromwkb"(bytea, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_multi"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_multi"("public"."geometry");
CREATE FUNCTION "public"."st_multi"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_force_multi'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_multi"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_multi"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_multilinefromwkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."st_multilinefromwkb"(bytea);
CREATE FUNCTION "public"."st_multilinefromwkb"(bytea)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTILINESTRING'
	THEN GeomFromWKB($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_multilinefromwkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_multilinefromwkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_multilinestringfromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."st_multilinestringfromtext"(text, int4);
CREATE FUNCTION "public"."st_multilinestringfromtext"(text, int4)
  RETURNS geometry AS 
$BODY$SELECT MLineFromText($1, $2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_multilinestringfromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_multilinestringfromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_multilinestringfromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."st_multilinestringfromtext"(text);
CREATE FUNCTION "public"."st_multilinestringfromtext"(text)
  RETURNS geometry AS 
$BODY$SELECT MLineFromText($1)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_multilinestringfromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_multilinestringfromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_multipointfromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."st_multipointfromtext"(text);
CREATE FUNCTION "public"."st_multipointfromtext"(text)
  RETURNS geometry AS 
$BODY$SELECT MPointFromText($1)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_multipointfromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_multipointfromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_multipointfromwkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."st_multipointfromwkb"(bytea);
CREATE FUNCTION "public"."st_multipointfromwkb"(bytea)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTIPOINT'
	THEN GeomFromWKB($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_multipointfromwkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_multipointfromwkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_multipointfromwkb"(bytea, int4)
-- ----------------------------
DROP FUNCTION "public"."st_multipointfromwkb"(bytea, int4);
CREATE FUNCTION "public"."st_multipointfromwkb"(bytea, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1,$2)) = 'MULTIPOINT'
	THEN GeomFromWKB($1, $2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_multipointfromwkb"(bytea, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_multipointfromwkb"(bytea, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_multipolyfromwkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."st_multipolyfromwkb"(bytea);
CREATE FUNCTION "public"."st_multipolyfromwkb"(bytea)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTIPOLYGON'
	THEN GeomFromWKB($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_multipolyfromwkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_multipolyfromwkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_multipolyfromwkb"(bytea, int4)
-- ----------------------------
DROP FUNCTION "public"."st_multipolyfromwkb"(bytea, int4);
CREATE FUNCTION "public"."st_multipolyfromwkb"(bytea, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'MULTIPOLYGON'
	THEN GeomFromWKB($1, $2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_multipolyfromwkb"(bytea, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_multipolyfromwkb"(bytea, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_multipolygonfromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."st_multipolygonfromtext"(text);
CREATE FUNCTION "public"."st_multipolygonfromtext"(text)
  RETURNS geometry AS 
$BODY$SELECT MPolyFromText($1)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_multipolygonfromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_multipolygonfromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_multipolygonfromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."st_multipolygonfromtext"(text, int4);
CREATE FUNCTION "public"."st_multipolygonfromtext"(text, int4)
  RETURNS geometry AS 
$BODY$SELECT MPolyFromText($1, $2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_multipolygonfromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_multipolygonfromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_ndims"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_ndims"("public"."geometry");
CREATE FUNCTION "public"."st_ndims"("public"."geometry")
  RETURNS int2 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_ndims'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_ndims"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_ndims"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_noop"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_noop"("public"."geometry");
CREATE FUNCTION "public"."st_noop"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_noop'
  LANGUAGE 'c' VOLATILE;
ALTER FUNCTION "public"."st_noop"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_noop"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_npoints"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_npoints"("public"."geometry");
CREATE FUNCTION "public"."st_npoints"("public"."geometry")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_npoints'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_npoints"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_npoints"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_nrings"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_nrings"("public"."geometry");
CREATE FUNCTION "public"."st_nrings"("public"."geometry")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_nrings'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_nrings"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_nrings"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_numgeometries"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_numgeometries"("public"."geometry");
CREATE FUNCTION "public"."st_numgeometries"("public"."geometry")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_numgeometries_collection'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_numgeometries"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_numgeometries"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_numinteriorring"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_numinteriorring"("public"."geometry");
CREATE FUNCTION "public"."st_numinteriorring"("public"."geometry")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_numinteriorrings_polygon'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_numinteriorring"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_numinteriorring"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_numinteriorrings"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_numinteriorrings"("public"."geometry");
CREATE FUNCTION "public"."st_numinteriorrings"("public"."geometry")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_numinteriorrings_polygon'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_numinteriorrings"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_numinteriorrings"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_numpoints"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_numpoints"("public"."geometry");
CREATE FUNCTION "public"."st_numpoints"("public"."geometry")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_numpoints_linestring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_numpoints"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_numpoints"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_orderingequals"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_orderingequals"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_orderingequals"("public"."geometry", "public"."geometry")
  RETURNS bool AS 
$BODY$
    SELECT $1 && $2 AND $1 ~= $2
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_orderingequals"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_orderingequals"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_overlaps"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_overlaps"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_overlaps"("public"."geometry", "public"."geometry")
  RETURNS bool AS 
$BODY$SELECT $1 && $2 AND _ST_Overlaps($1,$2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_overlaps"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_overlaps"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_perimeter"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_perimeter"("public"."geometry");
CREATE FUNCTION "public"."st_perimeter"("public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_perimeter2d_poly'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_perimeter"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_perimeter"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_perimeter2d"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_perimeter2d"("public"."geometry");
CREATE FUNCTION "public"."st_perimeter2d"("public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_perimeter2d_poly'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_perimeter2d"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_perimeter2d"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_perimeter3d"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_perimeter3d"("public"."geometry");
CREATE FUNCTION "public"."st_perimeter3d"("public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_perimeter_poly'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_perimeter3d"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_perimeter3d"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_point"(float8, float8)
-- ----------------------------
DROP FUNCTION "public"."st_point"(float8, float8);
CREATE FUNCTION "public"."st_point"(float8, float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_makepoint'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_point"(float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_point"(float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_point_inside_circle"("public"."geometry", float8, float8, float8)
-- ----------------------------
DROP FUNCTION "public"."st_point_inside_circle"("public"."geometry", float8, float8, float8);
CREATE FUNCTION "public"."st_point_inside_circle"("public"."geometry", float8, float8, float8)
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_inside_circle_point'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_point_inside_circle"("public"."geometry", float8, float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_point_inside_circle"("public"."geometry", float8, float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_pointfromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."st_pointfromtext"(text);
CREATE FUNCTION "public"."st_pointfromtext"(text)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'POINT'
	THEN GeomFromText($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_pointfromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_pointfromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_pointfromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."st_pointfromtext"(text, int4);
CREATE FUNCTION "public"."st_pointfromtext"(text, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromText($1, $2)) = 'POINT'
	THEN GeomFromText($1, $2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_pointfromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_pointfromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_pointfromwkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."st_pointfromwkb"(bytea);
CREATE FUNCTION "public"."st_pointfromwkb"(bytea)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'POINT'
	THEN GeomFromWKB($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_pointfromwkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_pointfromwkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_pointfromwkb"(bytea, int4)
-- ----------------------------
DROP FUNCTION "public"."st_pointfromwkb"(bytea, int4);
CREATE FUNCTION "public"."st_pointfromwkb"(bytea, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'POINT'
	THEN GeomFromWKB($1, $2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_pointfromwkb"(bytea, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_pointfromwkb"(bytea, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_pointn"("public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."st_pointn"("public"."geometry", int4);
CREATE FUNCTION "public"."st_pointn"("public"."geometry", int4)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_pointn_linestring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_pointn"("public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_pointn"("public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_pointonsurface"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_pointonsurface"("public"."geometry");
CREATE FUNCTION "public"."st_pointonsurface"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'pointonsurface'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_pointonsurface"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_pointonsurface"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_polyfromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."st_polyfromtext"(text, int4);
CREATE FUNCTION "public"."st_polyfromtext"(text, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromText($1, $2)) = 'POLYGON'
	THEN GeomFromText($1, $2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_polyfromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_polyfromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_polyfromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."st_polyfromtext"(text);
CREATE FUNCTION "public"."st_polyfromtext"(text)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'POLYGON'
	THEN GeomFromText($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_polyfromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_polyfromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_polyfromwkb"(bytea, int4)
-- ----------------------------
DROP FUNCTION "public"."st_polyfromwkb"(bytea, int4);
CREATE FUNCTION "public"."st_polyfromwkb"(bytea, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'POLYGON'
	THEN GeomFromWKB($1, $2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_polyfromwkb"(bytea, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_polyfromwkb"(bytea, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_polyfromwkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."st_polyfromwkb"(bytea);
CREATE FUNCTION "public"."st_polyfromwkb"(bytea)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'POLYGON'
	THEN GeomFromWKB($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_polyfromwkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_polyfromwkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_polygon"("public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."st_polygon"("public"."geometry", int4);
CREATE FUNCTION "public"."st_polygon"("public"."geometry", int4)
  RETURNS geometry AS 
$BODY$
	SELECT setSRID(makepolygon($1), $2)
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_polygon"("public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_polygon"("public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_polygonfromtext"(text, int4)
-- ----------------------------
DROP FUNCTION "public"."st_polygonfromtext"(text, int4);
CREATE FUNCTION "public"."st_polygonfromtext"(text, int4)
  RETURNS geometry AS 
$BODY$SELECT PolyFromText($1, $2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_polygonfromtext"(text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_polygonfromtext"(text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_polygonfromtext"(text)
-- ----------------------------
DROP FUNCTION "public"."st_polygonfromtext"(text);
CREATE FUNCTION "public"."st_polygonfromtext"(text)
  RETURNS geometry AS 
$BODY$SELECT PolyFromText($1)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_polygonfromtext"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_polygonfromtext"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_polygonfromwkb"(bytea)
-- ----------------------------
DROP FUNCTION "public"."st_polygonfromwkb"(bytea);
CREATE FUNCTION "public"."st_polygonfromwkb"(bytea)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'POLYGON'
	THEN GeomFromWKB($1)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_polygonfromwkb"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_polygonfromwkb"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_polygonfromwkb"(bytea, int4)
-- ----------------------------
DROP FUNCTION "public"."st_polygonfromwkb"(bytea, int4);
CREATE FUNCTION "public"."st_polygonfromwkb"(bytea, int4)
  RETURNS geometry AS 
$BODY$
	SELECT CASE WHEN geometrytype(GeomFromWKB($1,$2)) = 'POLYGON'
	THEN GeomFromWKB($1, $2)
	ELSE NULL END
	$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_polygonfromwkb"(bytea, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_polygonfromwkb"(bytea, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_polygonize_garray"("public"."_geometry")
-- ----------------------------
DROP FUNCTION "public"."st_polygonize_garray"("public"."_geometry");
CREATE FUNCTION "public"."st_polygonize_garray"("public"."_geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'polygonize_garray'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_polygonize_garray"("public"."_geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_polygonize_garray"("public"."_geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_postgis_gist_joinsel"(internal, oid, internal, int2)
-- ----------------------------
DROP FUNCTION "public"."st_postgis_gist_joinsel"(internal, oid, internal, int2);
CREATE FUNCTION "public"."st_postgis_gist_joinsel"(internal, oid, internal, int2)
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_gist_joinsel'
  LANGUAGE 'c' VOLATILE;
ALTER FUNCTION "public"."st_postgis_gist_joinsel"(internal, oid, internal, int2) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_postgis_gist_joinsel"(internal, oid, internal, int2) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_postgis_gist_sel"(internal, oid, internal, int4)
-- ----------------------------
DROP FUNCTION "public"."st_postgis_gist_sel"(internal, oid, internal, int4);
CREATE FUNCTION "public"."st_postgis_gist_sel"(internal, oid, internal, int4)
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_gist_sel'
  LANGUAGE 'c' VOLATILE;
ALTER FUNCTION "public"."st_postgis_gist_sel"(internal, oid, internal, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_postgis_gist_sel"(internal, oid, internal, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_relate"("public"."geometry", "public"."geometry", text)
-- ----------------------------
DROP FUNCTION "public"."st_relate"("public"."geometry", "public"."geometry", text);
CREATE FUNCTION "public"."st_relate"("public"."geometry", "public"."geometry", text)
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'relate_pattern'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_relate"("public"."geometry", "public"."geometry", text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_relate"("public"."geometry", "public"."geometry", text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_relate"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_relate"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_relate"("public"."geometry", "public"."geometry")
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'relate_full'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_relate"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_relate"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_removepoint"("public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."st_removepoint"("public"."geometry", int4);
CREATE FUNCTION "public"."st_removepoint"("public"."geometry", int4)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_removepoint'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_removepoint"("public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_removepoint"("public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_reverse"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_reverse"("public"."geometry");
CREATE FUNCTION "public"."st_reverse"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_reverse'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_reverse"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_reverse"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_rotate"("public"."geometry", float8)
-- ----------------------------
DROP FUNCTION "public"."st_rotate"("public"."geometry", float8);
CREATE FUNCTION "public"."st_rotate"("public"."geometry", float8)
  RETURNS geometry AS 
$BODY$SELECT rotateZ($1, $2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_rotate"("public"."geometry", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_rotate"("public"."geometry", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_rotatex"("public"."geometry", float8)
-- ----------------------------
DROP FUNCTION "public"."st_rotatex"("public"."geometry", float8);
CREATE FUNCTION "public"."st_rotatex"("public"."geometry", float8)
  RETURNS geometry AS 
$BODY$SELECT affine($1, 1, 0, 0, 0, cos($2), -sin($2), 0, sin($2), cos($2), 0, 0, 0)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_rotatex"("public"."geometry", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_rotatex"("public"."geometry", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_rotatey"("public"."geometry", float8)
-- ----------------------------
DROP FUNCTION "public"."st_rotatey"("public"."geometry", float8);
CREATE FUNCTION "public"."st_rotatey"("public"."geometry", float8)
  RETURNS geometry AS 
$BODY$SELECT affine($1,  cos($2), 0, sin($2),  0, 1, 0,  -sin($2), 0, cos($2), 0,  0, 0)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_rotatey"("public"."geometry", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_rotatey"("public"."geometry", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_rotatez"("public"."geometry", float8)
-- ----------------------------
DROP FUNCTION "public"."st_rotatez"("public"."geometry", float8);
CREATE FUNCTION "public"."st_rotatez"("public"."geometry", float8)
  RETURNS geometry AS 
$BODY$SELECT affine($1,  cos($2), -sin($2), 0,  sin($2), cos($2), 0,  0, 0, 1,  0, 0, 0)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_rotatez"("public"."geometry", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_rotatez"("public"."geometry", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_scale"("public"."geometry", float8, float8)
-- ----------------------------
DROP FUNCTION "public"."st_scale"("public"."geometry", float8, float8);
CREATE FUNCTION "public"."st_scale"("public"."geometry", float8, float8)
  RETURNS geometry AS 
$BODY$SELECT scale($1, $2, $3, 1)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_scale"("public"."geometry", float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_scale"("public"."geometry", float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_scale"("public"."geometry", float8, float8, float8)
-- ----------------------------
DROP FUNCTION "public"."st_scale"("public"."geometry", float8, float8, float8);
CREATE FUNCTION "public"."st_scale"("public"."geometry", float8, float8, float8)
  RETURNS geometry AS 
$BODY$SELECT affine($1,  $2, 0, 0,  0, $3, 0,  0, 0, $4,  0, 0, 0)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_scale"("public"."geometry", float8, float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_scale"("public"."geometry", float8, float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_segmentize"("public"."geometry", float8)
-- ----------------------------
DROP FUNCTION "public"."st_segmentize"("public"."geometry", float8);
CREATE FUNCTION "public"."st_segmentize"("public"."geometry", float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_segmentize2d'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_segmentize"("public"."geometry", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_segmentize"("public"."geometry", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_setfactor"("public"."chip", float4)
-- ----------------------------
DROP FUNCTION "public"."st_setfactor"("public"."chip", float4);
CREATE FUNCTION "public"."st_setfactor"("public"."chip", float4)
  RETURNS chip AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'CHIP_setFactor'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_setfactor"("public"."chip", float4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_setfactor"("public"."chip", float4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_setpoint"("public"."geometry", int4, "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_setpoint"("public"."geometry", int4, "public"."geometry");
CREATE FUNCTION "public"."st_setpoint"("public"."geometry", int4, "public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_setpoint_linestring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_setpoint"("public"."geometry", int4, "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_setpoint"("public"."geometry", int4, "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_setsrid"("public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."st_setsrid"("public"."geometry", int4);
CREATE FUNCTION "public"."st_setsrid"("public"."geometry", int4)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_setSRID'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_setsrid"("public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_setsrid"("public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_shift_longitude"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_shift_longitude"("public"."geometry");
CREATE FUNCTION "public"."st_shift_longitude"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_longitude_shift'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_shift_longitude"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_shift_longitude"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_simplify"("public"."geometry", float8)
-- ----------------------------
DROP FUNCTION "public"."st_simplify"("public"."geometry", float8);
CREATE FUNCTION "public"."st_simplify"("public"."geometry", float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_simplify2d'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_simplify"("public"."geometry", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_simplify"("public"."geometry", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_snaptogrid"("public"."geometry", float8)
-- ----------------------------
DROP FUNCTION "public"."st_snaptogrid"("public"."geometry", float8);
CREATE FUNCTION "public"."st_snaptogrid"("public"."geometry", float8)
  RETURNS geometry AS 
$BODY$SELECT SnapToGrid($1, 0, 0, $2, $2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_snaptogrid"("public"."geometry", float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_snaptogrid"("public"."geometry", float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_snaptogrid"("public"."geometry", "public"."geometry", float8, float8, float8, float8)
-- ----------------------------
DROP FUNCTION "public"."st_snaptogrid"("public"."geometry", "public"."geometry", float8, float8, float8, float8);
CREATE FUNCTION "public"."st_snaptogrid"("public"."geometry", "public"."geometry", float8, float8, float8, float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_snaptogrid_pointoff'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_snaptogrid"("public"."geometry", "public"."geometry", float8, float8, float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_snaptogrid"("public"."geometry", "public"."geometry", float8, float8, float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_snaptogrid"("public"."geometry", float8, float8)
-- ----------------------------
DROP FUNCTION "public"."st_snaptogrid"("public"."geometry", float8, float8);
CREATE FUNCTION "public"."st_snaptogrid"("public"."geometry", float8, float8)
  RETURNS geometry AS 
$BODY$SELECT SnapToGrid($1, 0, 0, $2, $3)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_snaptogrid"("public"."geometry", float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_snaptogrid"("public"."geometry", float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_snaptogrid"("public"."geometry", float8, float8, float8, float8)
-- ----------------------------
DROP FUNCTION "public"."st_snaptogrid"("public"."geometry", float8, float8, float8, float8);
CREATE FUNCTION "public"."st_snaptogrid"("public"."geometry", float8, float8, float8, float8)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_snaptogrid'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_snaptogrid"("public"."geometry", float8, float8, float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_snaptogrid"("public"."geometry", float8, float8, float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_spheroid_in"(cstring)
-- ----------------------------
DROP FUNCTION "public"."st_spheroid_in"(cstring);
CREATE FUNCTION "public"."st_spheroid_in"(cstring)
  RETURNS spheroid AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'ellipsoid_in'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_spheroid_in"(cstring) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_spheroid_in"(cstring) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_spheroid_out"("public"."spheroid")
-- ----------------------------
DROP FUNCTION "public"."st_spheroid_out"("public"."spheroid");
CREATE FUNCTION "public"."st_spheroid_out"("public"."spheroid")
  RETURNS cstring AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'ellipsoid_out'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_spheroid_out"("public"."spheroid") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_spheroid_out"("public"."spheroid") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_srid"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_srid"("public"."geometry");
CREATE FUNCTION "public"."st_srid"("public"."geometry")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_getSRID'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_srid"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_srid"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_srid"("public"."chip")
-- ----------------------------
DROP FUNCTION "public"."st_srid"("public"."chip");
CREATE FUNCTION "public"."st_srid"("public"."chip")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'CHIP_getSRID'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_srid"("public"."chip") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_srid"("public"."chip") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_startpoint"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_startpoint"("public"."geometry");
CREATE FUNCTION "public"."st_startpoint"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_startpoint_linestring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_startpoint"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_startpoint"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_summary"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_summary"("public"."geometry");
CREATE FUNCTION "public"."st_summary"("public"."geometry")
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_summary'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_summary"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_summary"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_symdifference"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_symdifference"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_symdifference"("public"."geometry", "public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'symdifference'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_symdifference"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_symdifference"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_symmetricdifference"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_symmetricdifference"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_symmetricdifference"("public"."geometry", "public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'symdifference'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_symmetricdifference"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_symmetricdifference"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_text"(bool)
-- ----------------------------
DROP FUNCTION "public"."st_text"(bool);
CREATE FUNCTION "public"."st_text"(bool)
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOOL_to_text'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_text"(bool) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_text"(bool) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_text"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_text"("public"."geometry");
CREATE FUNCTION "public"."st_text"("public"."geometry")
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_to_text'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_text"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_text"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_touches"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_touches"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_touches"("public"."geometry", "public"."geometry")
  RETURNS bool AS 
$BODY$SELECT $1 && $2 AND _ST_Touches($1,$2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_touches"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_touches"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_transform"("public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."st_transform"("public"."geometry", int4);
CREATE FUNCTION "public"."st_transform"("public"."geometry", int4)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'transform'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_transform"("public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_transform"("public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_translate"("public"."geometry", float8, float8)
-- ----------------------------
DROP FUNCTION "public"."st_translate"("public"."geometry", float8, float8);
CREATE FUNCTION "public"."st_translate"("public"."geometry", float8, float8)
  RETURNS geometry AS 
$BODY$SELECT translate($1, $2, $3, 0)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_translate"("public"."geometry", float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_translate"("public"."geometry", float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_translate"("public"."geometry", float8, float8, float8)
-- ----------------------------
DROP FUNCTION "public"."st_translate"("public"."geometry", float8, float8, float8);
CREATE FUNCTION "public"."st_translate"("public"."geometry", float8, float8, float8)
  RETURNS geometry AS 
$BODY$SELECT affine($1, 1, 0, 0, 0, 1, 0, 0, 0, 1, $2, $3, $4)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_translate"("public"."geometry", float8, float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_translate"("public"."geometry", float8, float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_transscale"("public"."geometry", float8, float8, float8, float8)
-- ----------------------------
DROP FUNCTION "public"."st_transscale"("public"."geometry", float8, float8, float8, float8);
CREATE FUNCTION "public"."st_transscale"("public"."geometry", float8, float8, float8, float8)
  RETURNS geometry AS 
$BODY$SELECT affine($1,  $4, 0, 0,  0, $5, 0, 
		0, 0, 1,  $2 * $4, $3 * $5, 0)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_transscale"("public"."geometry", float8, float8, float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_transscale"("public"."geometry", float8, float8, float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_union"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_union"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_union"("public"."geometry", "public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'geomunion'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_union"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_union"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_unite_garray"("public"."_geometry")
-- ----------------------------
DROP FUNCTION "public"."st_unite_garray"("public"."_geometry");
CREATE FUNCTION "public"."st_unite_garray"("public"."_geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'unite_garray'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_unite_garray"("public"."_geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_unite_garray"("public"."_geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_width"("public"."chip")
-- ----------------------------
DROP FUNCTION "public"."st_width"("public"."chip");
CREATE FUNCTION "public"."st_width"("public"."chip")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'CHIP_getWidth'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_width"("public"."chip") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_width"("public"."chip") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_within"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_within"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."st_within"("public"."geometry", "public"."geometry")
  RETURNS bool AS 
$BODY$SELECT $1 && $2 AND _ST_Within($1,$2)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_within"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_within"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_wkbtosql"(bytea)
-- ----------------------------
DROP FUNCTION "public"."st_wkbtosql"(bytea);
CREATE FUNCTION "public"."st_wkbtosql"(bytea)
  RETURNS geometry AS 
$BODY$SELECT GeomFromWKB($1)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_wkbtosql"(bytea) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_wkbtosql"(bytea) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_wkttosql"(text)
-- ----------------------------
DROP FUNCTION "public"."st_wkttosql"(text);
CREATE FUNCTION "public"."st_wkttosql"(text)
  RETURNS geometry AS 
$BODY$SELECT geometryfromtext($1)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."st_wkttosql"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_wkttosql"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."st_x"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_x"("public"."geometry");
CREATE FUNCTION "public"."st_x"("public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_x_point'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_x"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_x"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_xmax"("public"."box3d")
-- ----------------------------
DROP FUNCTION "public"."st_xmax"("public"."box3d");
CREATE FUNCTION "public"."st_xmax"("public"."box3d")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_xmax'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_xmax"("public"."box3d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_xmax"("public"."box3d") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_xmin"("public"."box3d")
-- ----------------------------
DROP FUNCTION "public"."st_xmin"("public"."box3d");
CREATE FUNCTION "public"."st_xmin"("public"."box3d")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_xmin'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_xmin"("public"."box3d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_xmin"("public"."box3d") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_y"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_y"("public"."geometry");
CREATE FUNCTION "public"."st_y"("public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_y_point'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_y"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_y"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_ymax"("public"."box3d")
-- ----------------------------
DROP FUNCTION "public"."st_ymax"("public"."box3d");
CREATE FUNCTION "public"."st_ymax"("public"."box3d")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_ymax'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_ymax"("public"."box3d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_ymax"("public"."box3d") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_ymin"("public"."box3d")
-- ----------------------------
DROP FUNCTION "public"."st_ymin"("public"."box3d");
CREATE FUNCTION "public"."st_ymin"("public"."box3d")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_ymin'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_ymin"("public"."box3d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_ymin"("public"."box3d") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_z"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_z"("public"."geometry");
CREATE FUNCTION "public"."st_z"("public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_z_point'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_z"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_z"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_zmax"("public"."box3d")
-- ----------------------------
DROP FUNCTION "public"."st_zmax"("public"."box3d");
CREATE FUNCTION "public"."st_zmax"("public"."box3d")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_zmax'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_zmax"("public"."box3d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_zmax"("public"."box3d") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_zmflag"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."st_zmflag"("public"."geometry");
CREATE FUNCTION "public"."st_zmflag"("public"."geometry")
  RETURNS int2 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_zmflag'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_zmflag"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_zmflag"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."st_zmin"("public"."box3d")
-- ----------------------------
DROP FUNCTION "public"."st_zmin"("public"."box3d");
CREATE FUNCTION "public"."st_zmin"("public"."box3d")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_zmin'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."st_zmin"("public"."box3d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."st_zmin"("public"."box3d") IS '';
;

-- ----------------------------
-- Function structure for "public"."startpoint"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."startpoint"("public"."geometry");
CREATE FUNCTION "public"."startpoint"("public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_startpoint_linestring'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."startpoint"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."startpoint"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."summary"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."summary"("public"."geometry");
CREATE FUNCTION "public"."summary"("public"."geometry")
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_summary'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."summary"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."summary"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."symdifference"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."symdifference"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."symdifference"("public"."geometry", "public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'symdifference'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."symdifference"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."symdifference"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."symmetricdifference"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."symmetricdifference"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."symmetricdifference"("public"."geometry", "public"."geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'symdifference'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."symmetricdifference"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."symmetricdifference"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."text"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."text"("public"."geometry");
CREATE FUNCTION "public"."text"("public"."geometry")
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_to_text'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."text"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."text"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."text"(bool)
-- ----------------------------
DROP FUNCTION "public"."text"(bool);
CREATE FUNCTION "public"."text"(bool)
  RETURNS text AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOOL_to_text'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."text"(bool) OWNER TO postgres;
COMMENT ON FUNCTION "public"."text"(bool) IS '';
;

-- ----------------------------
-- Function structure for "public"."touches"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."touches"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."touches"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'touches'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."touches"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."touches"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."transform"("public"."geometry", int4)
-- ----------------------------
DROP FUNCTION "public"."transform"("public"."geometry", int4);
CREATE FUNCTION "public"."transform"("public"."geometry", int4)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'transform'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."transform"("public"."geometry", int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."transform"("public"."geometry", int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."transform_geometry"("public"."geometry", text, text, int4)
-- ----------------------------
DROP FUNCTION "public"."transform_geometry"("public"."geometry", text, text, int4);
CREATE FUNCTION "public"."transform_geometry"("public"."geometry", text, text, int4)
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'transform_geom'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."transform_geometry"("public"."geometry", text, text, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."transform_geometry"("public"."geometry", text, text, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."translate"("public"."geometry", float8, float8)
-- ----------------------------
DROP FUNCTION "public"."translate"("public"."geometry", float8, float8);
CREATE FUNCTION "public"."translate"("public"."geometry", float8, float8)
  RETURNS geometry AS 
$BODY$SELECT translate($1, $2, $3, 0)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."translate"("public"."geometry", float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."translate"("public"."geometry", float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."translate"("public"."geometry", float8, float8, float8)
-- ----------------------------
DROP FUNCTION "public"."translate"("public"."geometry", float8, float8, float8);
CREATE FUNCTION "public"."translate"("public"."geometry", float8, float8, float8)
  RETURNS geometry AS 
$BODY$SELECT affine($1, 1, 0, 0, 0, 1, 0, 0, 0, 1, $2, $3, $4)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."translate"("public"."geometry", float8, float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."translate"("public"."geometry", float8, float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."transscale"("public"."geometry", float8, float8, float8, float8)
-- ----------------------------
DROP FUNCTION "public"."transscale"("public"."geometry", float8, float8, float8, float8);
CREATE FUNCTION "public"."transscale"("public"."geometry", float8, float8, float8, float8)
  RETURNS geometry AS 
$BODY$SELECT affine($1,  $4, 0, 0,  0, $5, 0, 
		0, 0, 1,  $2 * $4, $3 * $5, 0)$BODY$  LANGUAGE 'sql' IMMUTABLE;
ALTER FUNCTION "public"."transscale"("public"."geometry", float8, float8, float8, float8) OWNER TO postgres;
COMMENT ON FUNCTION "public"."transscale"("public"."geometry", float8, float8, float8, float8) IS '';
;

-- ----------------------------
-- Function structure for "public"."unite_garray"("public"."_geometry")
-- ----------------------------
DROP FUNCTION "public"."unite_garray"("public"."_geometry");
CREATE FUNCTION "public"."unite_garray"("public"."_geometry")
  RETURNS geometry AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'unite_garray'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."unite_garray"("public"."_geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."unite_garray"("public"."_geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."unlockrows"(text)
-- ----------------------------
DROP FUNCTION "public"."unlockrows"(text);
CREATE FUNCTION "public"."unlockrows"(text)
  RETURNS int4 AS 
$BODY$
DECLARE
	ret int;
BEGIN

	IF NOT LongTransactionsEnabled() THEN
		RAISE EXCEPTION 'Long transaction support disabled, use EnableLongTransaction() to enable.';
	END IF;

	EXECUTE 'DELETE FROM authorization_table where authid = ' ||
		quote_literal($1);

	GET DIAGNOSTICS ret = ROW_COUNT;

	RETURN ret;
END;
$BODY$  LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION "public"."unlockrows"(text) OWNER TO postgres;
COMMENT ON FUNCTION "public"."unlockrows"(text) IS '';
;

-- ----------------------------
-- Function structure for "public"."update_geometry_stats"(varchar, varchar)
-- ----------------------------
DROP FUNCTION "public"."update_geometry_stats"(varchar, varchar);
CREATE FUNCTION "public"."update_geometry_stats"(varchar, varchar)
  RETURNS text AS 
$BODY$SELECT update_geometry_stats();$BODY$  LANGUAGE 'sql' VOLATILE;
ALTER FUNCTION "public"."update_geometry_stats"(varchar, varchar) OWNER TO postgres;
COMMENT ON FUNCTION "public"."update_geometry_stats"(varchar, varchar) IS '';
;

-- ----------------------------
-- Function structure for "public"."update_geometry_stats"()
-- ----------------------------
DROP FUNCTION "public"."update_geometry_stats"();
CREATE FUNCTION "public"."update_geometry_stats"()
  RETURNS text AS 
$BODY$ SELECT 'update_geometry_stats() has been obsoleted. Statistics are automatically built running the ANALYZE command'::text$BODY$  LANGUAGE 'sql' VOLATILE;
ALTER FUNCTION "public"."update_geometry_stats"() OWNER TO postgres;
COMMENT ON FUNCTION "public"."update_geometry_stats"() IS '';
;

-- ----------------------------
-- Function structure for "public"."updategeometrysrid"(varchar, varchar, int4)
-- ----------------------------
DROP FUNCTION "public"."updategeometrysrid"(varchar, varchar, int4);
CREATE FUNCTION "public"."updategeometrysrid"(varchar, varchar, int4)
  RETURNS text AS 
$BODY$
DECLARE
	ret  text;
BEGIN
	SELECT UpdateGeometrySRID('','',$1,$2,$3) into ret;
	RETURN ret;
END;
$BODY$  LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION "public"."updategeometrysrid"(varchar, varchar, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."updategeometrysrid"(varchar, varchar, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."updategeometrysrid"(varchar, varchar, varchar, int4)
-- ----------------------------
DROP FUNCTION "public"."updategeometrysrid"(varchar, varchar, varchar, int4);
CREATE FUNCTION "public"."updategeometrysrid"(varchar, varchar, varchar, int4)
  RETURNS text AS 
$BODY$
DECLARE
	ret  text;
BEGIN
	SELECT UpdateGeometrySRID('',$1,$2,$3,$4) into ret;
	RETURN ret;
END;
$BODY$  LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION "public"."updategeometrysrid"(varchar, varchar, varchar, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."updategeometrysrid"(varchar, varchar, varchar, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."updategeometrysrid"(varchar, varchar, varchar, varchar, int4)
-- ----------------------------
DROP FUNCTION "public"."updategeometrysrid"(varchar, varchar, varchar, varchar, int4);
CREATE FUNCTION "public"."updategeometrysrid"(varchar, varchar, varchar, varchar, int4)
  RETURNS text AS 
$BODY$
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;
	myrec RECORD;
	okay boolean;
	cname varchar;
	real_schema name;

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 EXCEPTION 'Invalid schema name';
		ELSE
			real_schema = schema_name;
		END IF;
	ELSE
		SELECT INTO real_schema current_schema()::text;
	END IF;

 	-- 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;

	-- Update ref from geometry_columns table
	EXECUTE 'UPDATE geometry_columns SET SRID = ' || new_srid::text || 
		' where f_table_schema = ' ||
		quote_literal(real_schema) || ' and f_table_name = ' ||
		quote_literal(table_name)  || ' and f_geometry_column = ' ||
		quote_literal(column_name);
	
	-- Make up constraint name
	cname = 'enforce_srid_'  || column_name;

	-- Drop enforce_srid constraint
	EXECUTE 'ALTER TABLE ' || quote_ident(real_schema) ||
		'.' || quote_ident(table_name) ||
		' DROP constraint ' || quote_ident(cname);

	-- Update geometries SRID
	EXECUTE 'UPDATE ' || quote_ident(real_schema) ||
		'.' || quote_ident(table_name) ||
		' SET ' || quote_ident(column_name) ||
		' = setSRID(' || quote_ident(column_name) ||
		', ' || new_srid::text || ')';

	-- Reset enforce_srid constraint
	EXECUTE 'ALTER TABLE ' || quote_ident(real_schema) ||
		'.' || quote_ident(table_name) ||
		' ADD constraint ' || quote_ident(cname) ||
		' CHECK (srid(' || quote_ident(column_name) ||
		') = ' || new_srid::text || ')';

	RETURN real_schema || '.' || table_name || '.' || column_name ||' SRID changed to ' || new_srid::text;
	
END;
$BODY$  LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION "public"."updategeometrysrid"(varchar, varchar, varchar, varchar, int4) OWNER TO postgres;
COMMENT ON FUNCTION "public"."updategeometrysrid"(varchar, varchar, varchar, varchar, int4) IS '';
;

-- ----------------------------
-- Function structure for "public"."width"("public"."chip")
-- ----------------------------
DROP FUNCTION "public"."width"("public"."chip");
CREATE FUNCTION "public"."width"("public"."chip")
  RETURNS int4 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'CHIP_getWidth'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."width"("public"."chip") OWNER TO postgres;
COMMENT ON FUNCTION "public"."width"("public"."chip") IS '';
;

-- ----------------------------
-- Function structure for "public"."within"("public"."geometry", "public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."within"("public"."geometry", "public"."geometry");
CREATE FUNCTION "public"."within"("public"."geometry", "public"."geometry")
  RETURNS bool AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'within'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."within"("public"."geometry", "public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."within"("public"."geometry", "public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."x"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."x"("public"."geometry");
CREATE FUNCTION "public"."x"("public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_x_point'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."x"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."x"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."xmax"("public"."box3d")
-- ----------------------------
DROP FUNCTION "public"."xmax"("public"."box3d");
CREATE FUNCTION "public"."xmax"("public"."box3d")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_xmax'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."xmax"("public"."box3d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."xmax"("public"."box3d") IS '';
;

-- ----------------------------
-- Function structure for "public"."xmin"("public"."box3d")
-- ----------------------------
DROP FUNCTION "public"."xmin"("public"."box3d");
CREATE FUNCTION "public"."xmin"("public"."box3d")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_xmin'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."xmin"("public"."box3d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."xmin"("public"."box3d") IS '';
;

-- ----------------------------
-- Function structure for "public"."y"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."y"("public"."geometry");
CREATE FUNCTION "public"."y"("public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_y_point'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."y"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."y"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."ymax"("public"."box3d")
-- ----------------------------
DROP FUNCTION "public"."ymax"("public"."box3d");
CREATE FUNCTION "public"."ymax"("public"."box3d")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_ymax'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."ymax"("public"."box3d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."ymax"("public"."box3d") IS '';
;

-- ----------------------------
-- Function structure for "public"."ymin"("public"."box3d")
-- ----------------------------
DROP FUNCTION "public"."ymin"("public"."box3d");
CREATE FUNCTION "public"."ymin"("public"."box3d")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_ymin'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."ymin"("public"."box3d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."ymin"("public"."box3d") IS '';
;

-- ----------------------------
-- Function structure for "public"."z"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."z"("public"."geometry");
CREATE FUNCTION "public"."z"("public"."geometry")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_z_point'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."z"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."z"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."zmax"("public"."box3d")
-- ----------------------------
DROP FUNCTION "public"."zmax"("public"."box3d");
CREATE FUNCTION "public"."zmax"("public"."box3d")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_zmax'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."zmax"("public"."box3d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."zmax"("public"."box3d") IS '';
;

-- ----------------------------
-- Function structure for "public"."zmflag"("public"."geometry")
-- ----------------------------
DROP FUNCTION "public"."zmflag"("public"."geometry");
CREATE FUNCTION "public"."zmflag"("public"."geometry")
  RETURNS int2 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'LWGEOM_zmflag'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."zmflag"("public"."geometry") OWNER TO postgres;
COMMENT ON FUNCTION "public"."zmflag"("public"."geometry") IS '';
;

-- ----------------------------
-- Function structure for "public"."zmin"("public"."box3d")
-- ----------------------------
DROP FUNCTION "public"."zmin"("public"."box3d");
CREATE FUNCTION "public"."zmin"("public"."box3d")
  RETURNS float8 AS '/usr/lib/postgresql/8.3/lib/liblwgeom', 'BOX3D_zmin'
  LANGUAGE 'c' IMMUTABLE;
ALTER FUNCTION "public"."zmin"("public"."box3d") OWNER TO postgres;
COMMENT ON FUNCTION "public"."zmin"("public"."box3d") IS '';
;

-- ----------------------------
-- Records 
-- ----------------------------
INSERT INTO "elenchi"."e_azione" VALUES (1, 'inizia');
INSERT INTO "elenchi"."e_azione" VALUES (2, 'finisce');
INSERT INTO "elenchi"."e_azione" VALUES (3, 'continua');
INSERT INTO "elenchi"."e_categoria_oggetto" VALUES (2, 'sito militare');
INSERT INTO "elenchi"."e_categoria_oggetto" VALUES (3, 'sito civile');
INSERT INTO "elenchi"."e_categoria_oggetto" VALUES (4, 'sito religioso');
INSERT INTO "elenchi"."e_posizione" VALUES (2, 'vicino a');
INSERT INTO "elenchi"."e_posizione" VALUES (3, 'fuori');
INSERT INTO "elenchi"."e_posizione" VALUES (7, 'al confine');
INSERT INTO "elenchi"."e_posizione" VALUES (9, 'nei pressi');
INSERT INTO "elenchi"."e_posizione" VALUES (19, 'Presso');
INSERT INTO "elenchi"."e_tipo_oggetto" VALUES (21, 'aser', 'sito civile');
