--- a/setup/transitdata.sql +++ b/setup/transitdata.sql @@ -1,1 +1,1260 @@ +-- +-- PostgreSQL database dump +-- + +SET statement_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SET check_function_bodies = false; +SET client_min_messages = warning; + +-- +-- Name: topology; Type: SCHEMA; Schema: -; Owner: postgres +-- + +CREATE SCHEMA topology; + + +ALTER SCHEMA topology OWNER TO postgres; + +-- +-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: +-- + +CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; + + +-- +-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: +-- + +COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; + + +-- +-- Name: postgis; Type: EXTENSION; Schema: -; Owner: +-- + +CREATE EXTENSION IF NOT EXISTS postgis WITH SCHEMA public; + + +-- +-- Name: EXTENSION postgis; Type: COMMENT; Schema: -; Owner: +-- + +COMMENT ON EXTENSION postgis IS 'postgis geometry,geography, and raster spatial types and functions'; + + +-- +-- Name: postgis_topology; Type: EXTENSION; Schema: -; Owner: +-- + +CREATE EXTENSION IF NOT EXISTS postgis_topology WITH SCHEMA topology; + + +-- +-- Name: EXTENSION postgis_topology; Type: COMMENT; Schema: -; Owner: +-- + +COMMENT ON EXTENSION postgis_topology IS 'postgis topology spatial types and functions'; + + +SET search_path = public, pg_catalog; + +-- +-- Name: linefromtext(text); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION linefromtext(text) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'LINESTRING' + THEN GeomFromText($1) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.linefromtext(text) OWNER TO postgres; + +-- +-- Name: linefromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION linefromtext(text, integer) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromText($1, $2)) = 'LINESTRING' + THEN GeomFromText($1,$2) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.linefromtext(text, integer) OWNER TO postgres; + +-- +-- Name: linefromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION linefromwkb(bytea) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'LINESTRING' + THEN GeomFromWKB($1) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.linefromwkb(bytea) OWNER TO postgres; + +-- +-- Name: linefromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION linefromwkb(bytea, integer) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'LINESTRING' + THEN GeomFromWKB($1, $2) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.linefromwkb(bytea, integer) OWNER TO postgres; + +-- +-- Name: linestringfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION linestringfromtext(text) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$SELECT LineFromText($1)$_$; + + +ALTER FUNCTION public.linestringfromtext(text) OWNER TO postgres; + +-- +-- Name: linestringfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION linestringfromtext(text, integer) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$SELECT LineFromText($1, $2)$_$; + + +ALTER FUNCTION public.linestringfromtext(text, integer) OWNER TO postgres; + +-- +-- Name: linestringfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION linestringfromwkb(bytea) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'LINESTRING' + THEN GeomFromWKB($1) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.linestringfromwkb(bytea) OWNER TO postgres; + +-- +-- Name: linestringfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION linestringfromwkb(bytea, integer) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'LINESTRING' + THEN GeomFromWKB($1, $2) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.linestringfromwkb(bytea, integer) OWNER TO postgres; + +-- +-- Name: mlinefromtext(text); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION mlinefromtext(text) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'MULTILINESTRING' + THEN GeomFromText($1) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.mlinefromtext(text) OWNER TO postgres; + +-- +-- Name: mlinefromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION mlinefromtext(text, integer) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE + WHEN geometrytype(GeomFromText($1, $2)) = 'MULTILINESTRING' + THEN GeomFromText($1,$2) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.mlinefromtext(text, integer) OWNER TO postgres; + +-- +-- Name: mlinefromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION mlinefromwkb(bytea) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTILINESTRING' + THEN GeomFromWKB($1) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.mlinefromwkb(bytea) OWNER TO postgres; + +-- +-- Name: mlinefromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION mlinefromwkb(bytea, integer) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'MULTILINESTRING' + THEN GeomFromWKB($1, $2) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.mlinefromwkb(bytea, integer) OWNER TO postgres; + +-- +-- Name: mpointfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION mpointfromtext(text) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'MULTIPOINT' + THEN GeomFromText($1) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.mpointfromtext(text) OWNER TO postgres; + +-- +-- Name: mpointfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION mpointfromtext(text, integer) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromText($1,$2)) = 'MULTIPOINT' + THEN GeomFromText($1,$2) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.mpointfromtext(text, integer) OWNER TO postgres; + +-- +-- Name: mpointfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION mpointfromwkb(bytea) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTIPOINT' + THEN GeomFromWKB($1) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.mpointfromwkb(bytea) OWNER TO postgres; + +-- +-- Name: mpointfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION mpointfromwkb(bytea, integer) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromWKB($1,$2)) = 'MULTIPOINT' + THEN GeomFromWKB($1, $2) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.mpointfromwkb(bytea, integer) OWNER TO postgres; + +-- +-- Name: mpolyfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION mpolyfromtext(text) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'MULTIPOLYGON' + THEN GeomFromText($1) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.mpolyfromtext(text) OWNER TO postgres; + +-- +-- Name: mpolyfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION mpolyfromtext(text, integer) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromText($1, $2)) = 'MULTIPOLYGON' + THEN GeomFromText($1,$2) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.mpolyfromtext(text, integer) OWNER TO postgres; + +-- +-- Name: mpolyfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION mpolyfromwkb(bytea, integer) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'MULTIPOLYGON' + THEN GeomFromWKB($1, $2) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.mpolyfromwkb(bytea, integer) OWNER TO postgres; + +-- +-- Name: multilinefromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION multilinefromwkb(bytea) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTILINESTRING' + THEN GeomFromWKB($1) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.multilinefromwkb(bytea) OWNER TO postgres; + +-- +-- Name: multilinefromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION multilinefromwkb(bytea, integer) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'MULTILINESTRING' + THEN GeomFromWKB($1, $2) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.multilinefromwkb(bytea, integer) OWNER TO postgres; + +-- +-- Name: multilinestringfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION multilinestringfromtext(text) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$SELECT ST_MLineFromText($1)$_$; + + +ALTER FUNCTION public.multilinestringfromtext(text) OWNER TO postgres; + +-- +-- Name: multilinestringfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION multilinestringfromtext(text, integer) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$SELECT MLineFromText($1, $2)$_$; + + +ALTER FUNCTION public.multilinestringfromtext(text, integer) OWNER TO postgres; + +-- +-- Name: multipointfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION multipointfromtext(text) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$SELECT MPointFromText($1)$_$; + + +ALTER FUNCTION public.multipointfromtext(text) OWNER TO postgres; + +-- +-- Name: multipointfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION multipointfromtext(text, integer) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$SELECT MPointFromText($1, $2)$_$; + + +ALTER FUNCTION public.multipointfromtext(text, integer) OWNER TO postgres; + +-- +-- Name: multipointfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION multipointfromwkb(bytea) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTIPOINT' + THEN GeomFromWKB($1) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.multipointfromwkb(bytea) OWNER TO postgres; + +-- +-- Name: multipointfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION multipointfromwkb(bytea, integer) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromWKB($1,$2)) = 'MULTIPOINT' + THEN GeomFromWKB($1, $2) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.multipointfromwkb(bytea, integer) OWNER TO postgres; + +-- +-- Name: multipolyfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION multipolyfromwkb(bytea) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTIPOLYGON' + THEN GeomFromWKB($1) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.multipolyfromwkb(bytea) OWNER TO postgres; + +-- +-- Name: multipolyfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION multipolyfromwkb(bytea, integer) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'MULTIPOLYGON' + THEN GeomFromWKB($1, $2) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.multipolyfromwkb(bytea, integer) OWNER TO postgres; + +-- +-- Name: multipolygonfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION multipolygonfromtext(text) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$SELECT MPolyFromText($1)$_$; + + +ALTER FUNCTION public.multipolygonfromtext(text) OWNER TO postgres; + +-- +-- Name: multipolygonfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION multipolygonfromtext(text, integer) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$SELECT MPolyFromText($1, $2)$_$; + + +ALTER FUNCTION public.multipolygonfromtext(text, integer) OWNER TO postgres; + +-- +-- Name: pointfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION pointfromtext(text) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'POINT' + THEN GeomFromText($1) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.pointfromtext(text) OWNER TO postgres; + +-- +-- Name: pointfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION pointfromtext(text, integer) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromText($1, $2)) = 'POINT' + THEN GeomFromText($1,$2) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.pointfromtext(text, integer) OWNER TO postgres; + +-- +-- Name: pointfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION pointfromwkb(bytea) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'POINT' + THEN GeomFromWKB($1) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.pointfromwkb(bytea) OWNER TO postgres; + +-- +-- Name: pointfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION pointfromwkb(bytea, integer) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'POINT' + THEN GeomFromWKB($1, $2) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.pointfromwkb(bytea, integer) OWNER TO postgres; + +-- +-- Name: polyfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION polyfromtext(text) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'POLYGON' + THEN GeomFromText($1) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.polyfromtext(text) OWNER TO postgres; + +-- +-- Name: polyfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION polyfromtext(text, integer) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromText($1, $2)) = 'POLYGON' + THEN GeomFromText($1,$2) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.polyfromtext(text, integer) OWNER TO postgres; + +-- +-- Name: polyfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION polyfromwkb(bytea) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'POLYGON' + THEN GeomFromWKB($1) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.polyfromwkb(bytea) OWNER TO postgres; + +-- +-- Name: polyfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION polyfromwkb(bytea, integer) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'POLYGON' + THEN GeomFromWKB($1, $2) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.polyfromwkb(bytea, integer) OWNER TO postgres; + +-- +-- Name: polygonfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION polygonfromtext(text) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$SELECT PolyFromText($1)$_$; + + +ALTER FUNCTION public.polygonfromtext(text) OWNER TO postgres; + +-- +-- Name: polygonfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION polygonfromtext(text, integer) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$SELECT PolyFromText($1, $2)$_$; + + +ALTER FUNCTION public.polygonfromtext(text, integer) OWNER TO postgres; + +-- +-- Name: polygonfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION polygonfromwkb(bytea) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'POLYGON' + THEN GeomFromWKB($1) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.polygonfromwkb(bytea) OWNER TO postgres; + +-- +-- Name: polygonfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION polygonfromwkb(bytea, integer) RETURNS geometry + LANGUAGE sql IMMUTABLE STRICT + AS $_$ + SELECT CASE WHEN geometrytype(GeomFromWKB($1,$2)) = 'POLYGON' + THEN GeomFromWKB($1, $2) + ELSE NULL END + $_$; + + +ALTER FUNCTION public.polygonfromwkb(bytea, integer) OWNER TO postgres; + +-- +-- Name: st_askml(integer, geometry); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION st_askml(integer, geometry) RETURNS text + LANGUAGE sql IMMUTABLE STRICT + AS $_$SELECT _ST_AsKML($1, ST_Transform($2,4326), 15)$_$; + + +ALTER FUNCTION public.st_askml(integer, geometry) OWNER TO postgres; + +-- +-- Name: st_askml(integer, geography); Type: FUNCTION; Schema: public; Owner: postgres +-- + +CREATE FUNCTION st_askml(integer, geography) RETURNS text + LANGUAGE sql IMMUTABLE STRICT + AS $_$SELECT _ST_AsKML($1, $2, 15)$_$; + + +ALTER FUNCTION public.st_askml(integer, geography) OWNER TO postgres; + +-- +-- Name: memcollect(geometry); Type: AGGREGATE; Schema: public; Owner: postgres +-- + +CREATE AGGREGATE memcollect(geometry) ( + SFUNC = public.st_collect, + STYPE = geometry +); + + +ALTER AGGREGATE public.memcollect(geometry) OWNER TO postgres; + +-- +-- Name: st_extent3d(geometry); Type: AGGREGATE; Schema: public; Owner: postgres +-- + +CREATE AGGREGATE st_extent3d(geometry) ( + SFUNC = public.st_combine_bbox, + STYPE = box3d +); + + +ALTER AGGREGATE public.st_extent3d(geometry) OWNER TO postgres; + +SET default_tablespace = ''; + +SET default_with_oids = false; + +-- +-- Name: agency; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE agency ( + agency_name text NOT NULL, + agency_url text, + agency_timezone text, + agency_lang text, + agency_phone text, + agency_fare_url text, + agency_id integer +); + + +ALTER TABLE public.agency OWNER TO postgres; + +-- +-- Name: calendar; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE calendar ( + service_id text NOT NULL, + start_date text, + end_date text, + monday integer, + tuesday integer, + wednesday integer, + thursday integer, + friday integer, + saturday integer, + sunday integer +); + + +ALTER TABLE public.calendar OWNER TO postgres; + +-- +-- Name: calendar_dates; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE calendar_dates ( + service_id text NOT NULL, + date text NOT NULL, + exception_type text +); + + +ALTER TABLE public.calendar_dates OWNER TO postgres; + +-- +-- Name: fare_attributes; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE fare_attributes ( + fare_id text NOT NULL, + price double precision, + currency_type text, + payment_method integer, + transfers text, + transfer_duration integer +); + + +ALTER TABLE public.fare_attributes OWNER TO postgres; + +-- +-- Name: feed_info; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE feed_info ( + feed_publisher_name text NOT NULL, + feed_publisher_url text, + feed_lang text, + feed_start_date text, + feed_end_date text, + feed_version text +); + + +ALTER TABLE public.feed_info OWNER TO postgres; + +-- +-- Name: myway_observations; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE myway_observations ( + observation_id text NOT NULL, + myway_stop text, + "time" timestamp with time zone, + myway_route text +); + + +ALTER TABLE public.myway_observations OWNER TO postgres; + +-- +-- Name: myway_routes; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE myway_routes ( + myway_route text NOT NULL, + route_short_name text, + trip_headsign text +); + + +ALTER TABLE public.myway_routes OWNER TO postgres; + +-- +-- Name: myway_stops; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE myway_stops ( + myway_stop text NOT NULL, + stop_id text +); + + +ALTER TABLE public.myway_stops OWNER TO postgres; + +-- +-- Name: myway_timingdeltas; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE myway_timingdeltas ( + observation_id text NOT NULL, + route_id text, + stop_id text, + timing_delta integer, + "time" time with time zone, + date date, + timing_period text, + stop_sequence integer, + myway_stop text, + route_name text +); + + +ALTER TABLE public.myway_timingdeltas OWNER TO postgres; + +-- +-- Name: myway_timingdeltas_timing_period_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE myway_timingdeltas_timing_period_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.myway_timingdeltas_timing_period_seq OWNER TO postgres; + +-- +-- Name: myway_timingdeltas_timing_period_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE myway_timingdeltas_timing_period_seq OWNED BY myway_timingdeltas.timing_period; + + +-- +-- Name: routes; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE routes ( + route_id text NOT NULL, + route_short_name text, + route_long_name text, + route_desc text, + route_type integer, + route_url text, + route_text_color text, + route_color text, + agency_id text +); + + +ALTER TABLE public.routes OWNER TO postgres; + +-- +-- Name: servicealerts_alerts; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE servicealerts_alerts ( + id integer NOT NULL, + url text, + description text, + start timestamp with time zone, + "end" timestamp with time zone, + cause text, + effect text, + header text +); + + +ALTER TABLE public.servicealerts_alerts OWNER TO postgres; + +-- +-- Name: servicealerts_alerts_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE servicealerts_alerts_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.servicealerts_alerts_id_seq OWNER TO postgres; + +-- +-- Name: servicealerts_alerts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE servicealerts_alerts_id_seq OWNED BY servicealerts_alerts.id; + + +-- +-- Name: servicealerts_informed; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE servicealerts_informed ( + servicealert_id integer NOT NULL, + informed_class text NOT NULL, + informed_id text NOT NULL, + informed_action text +); + + +ALTER TABLE public.servicealerts_informed OWNER TO postgres; + +-- +-- Name: shapes; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE shapes ( + shape_id text NOT NULL, + shape_pt_lat double precision, + shape_pt_lon double precision, + shape_pt_sequence integer NOT NULL, + shape_dist_traveled integer, + shape_pt geography +); + + +ALTER TABLE public.shapes OWNER TO postgres; + +-- +-- Name: stop_times; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE stop_times ( + trip_id text NOT NULL, + arrival_time time without time zone, + departure_time time without time zone, + stop_id text, + stop_sequence integer NOT NULL, + stop_headsign text, + pickup_type text, + drop_off_type text, + shape_dist_traveled text +); + + +ALTER TABLE public.stop_times OWNER TO postgres; + +-- +-- Name: stops; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE stops ( + stop_id text NOT NULL, + stop_code text, + stop_name text, + stop_desc text, + stop_lat double precision, + stop_lon double precision, + zone_id text, + stop_url text, + location_type integer, + "position" geography +); + + +ALTER TABLE public.stops OWNER TO postgres; + +-- +-- Name: trips; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE trips ( + route_id text, + service_id text, + trip_id text NOT NULL, + trip_headsign text, + direction_id text, + block_id text, + shape_id text +); + + +ALTER TABLE public.trips OWNER TO postgres; + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE servicealerts_alerts ALTER COLUMN id SET DEFAULT nextval('servicealerts_alerts_id_seq'::regclass); + + +-- +-- Name: agency_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY agency + ADD CONSTRAINT agency_pkey PRIMARY KEY (agency_name); + + +-- +-- Name: calendar_dates_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY calendar_dates + ADD CONSTRAINT calendar_dates_pkey PRIMARY KEY (service_id, date); + + +-- +-- Name: calendar_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY calendar + ADD CONSTRAINT calendar_pkey PRIMARY KEY (service_id); + + +-- +-- Name: fare_attributes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY fare_attributes + ADD CONSTRAINT fare_attributes_pkey PRIMARY KEY (fare_id); + + +-- +-- Name: feed_info_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY feed_info + ADD CONSTRAINT feed_info_pkey PRIMARY KEY (feed_publisher_name); + + +-- +-- Name: myway_observations_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY myway_observations + ADD CONSTRAINT myway_observations_pkey PRIMARY KEY (observation_id); + + +-- +-- Name: myway_routes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY myway_routes + ADD CONSTRAINT myway_routes_pkey PRIMARY KEY (myway_route); + + +-- +-- Name: myway_timingdeltas_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY myway_timingdeltas + ADD CONSTRAINT myway_timingdeltas_pkey PRIMARY KEY (observation_id); + + +-- +-- Name: mywaystops_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY myway_stops + ADD CONSTRAINT mywaystops_pkey PRIMARY KEY (myway_stop); + + +-- +-- Name: routes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY routes + ADD CONSTRAINT routes_pkey PRIMARY KEY (route_id); + + +-- +-- Name: servicealerts_alerts_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY servicealerts_alerts + ADD CONSTRAINT servicealerts_alerts_pkey PRIMARY KEY (id); + + +-- +-- Name: servicealerts_informed_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY servicealerts_informed + ADD CONSTRAINT servicealerts_informed_pkey PRIMARY KEY (servicealert_id, informed_class, informed_id); + + +-- +-- Name: shapes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY shapes + ADD CONSTRAINT shapes_pkey PRIMARY KEY (shape_id, shape_pt_sequence); + + +-- +-- Name: stop_times_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY stop_times + ADD CONSTRAINT stop_times_pkey PRIMARY KEY (trip_id, stop_sequence); + + +-- +-- Name: stops_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY stops + ADD CONSTRAINT stops_pkey PRIMARY KEY (stop_id); + + +-- +-- Name: stops_stop_code_key; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY stops + ADD CONSTRAINT stops_stop_code_key UNIQUE (stop_code); + + +-- +-- Name: trips_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY trips + ADD CONSTRAINT trips_pkey PRIMARY KEY (trip_id); + + +-- +-- Name: routenumber; Type: INDEX; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE INDEX routenumber ON routes USING btree (route_short_name); + + +-- +-- Name: routetrips; Type: INDEX; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE INDEX routetrips ON trips USING btree (route_id); + + +-- +-- Name: starttime; Type: INDEX; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE UNIQUE INDEX starttime ON stop_times USING btree (trip_id, stop_id, stop_sequence); + + +-- +-- Name: stops_position_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE INDEX stops_position_idx ON stops USING gist ("position"); + + +-- +-- Name: stoptimes; Type: INDEX; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE INDEX stoptimes ON stop_times USING btree (arrival_time, stop_id); + + +-- +-- Name: times; Type: INDEX; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE INDEX times ON stop_times USING btree (arrival_time); + + +-- +-- Name: triptimes; Type: INDEX; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE INDEX triptimes ON stop_times USING btree (trip_id, arrival_time); + + +-- +-- Name: servicealerts_alertid; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY servicealerts_informed + ADD CONSTRAINT servicealerts_alertid FOREIGN KEY (servicealert_id) REFERENCES servicealerts_alerts(id); + + +-- +-- Name: public; Type: ACL; Schema: -; Owner: postgres +-- + +REVOKE ALL ON SCHEMA public FROM PUBLIC; +REVOKE ALL ON SCHEMA public FROM postgres; +GRANT ALL ON SCHEMA public TO postgres; +GRANT ALL ON SCHEMA public TO PUBLIC; + + +-- +-- Name: myway_observations; Type: ACL; Schema: public; Owner: postgres +-- + +REVOKE ALL ON TABLE myway_observations FROM PUBLIC; +REVOKE ALL ON TABLE myway_observations FROM postgres; +GRANT ALL ON TABLE myway_observations TO postgres; + + +-- +-- Name: stops; Type: ACL; Schema: public; Owner: postgres +-- + +REVOKE ALL ON TABLE stops FROM PUBLIC; +REVOKE ALL ON TABLE stops FROM postgres; +GRANT ALL ON TABLE stops TO postgres; +GRANT SELECT ON TABLE stops TO transitdata; + + +-- +-- PostgreSQL database dump complete +-- + +