transit pattern mapping table structure

transit pattern mapping table structure#

Information pertaining to GTFS map-matching is held on this table if the feed has been map-matched during the import process. This map-matching is required for running transit in traffic, but it is not required by the transit assignment per se.

Table Structure#

Field

Type

NULL allowed

Default Value

Foreign key

Description

pattern_id*

INTEGER

NO

Transit_Patterns(pattern_id)

ID of the transit pattern this mapping applies to

index

INTEGER

NO

Index of the link in the pattern

link

INTEGER

NO

Link(link)

ID of the link in the network

dir

INTEGER

NO

Direction of the link in network

stop_id

INTEGER

YES

Transit_Stops(stop_id)

ID of the transit stop that projects onto the given roadway link

offset

REAL

YES

Distance from the start of the link to the stop in meters

geo

LINESTRING

YES

(* - Primary key)

The SQL statement for table and index creation is below.

CREATE TABLE IF NOT EXISTS "Transit_Pattern_Mapping" (
    pattern_id INTEGER NOT NULL,
    "index"    INTEGER NOT NULL,
    link       INTEGER NOT NULL,
    dir        INTEGER NOT NULL,
    stop_id    INTEGER,
    offset     REAL,

    PRIMARY KEY(pattern_id,"index"),
    FOREIGN KEY(pattern_id) REFERENCES Transit_Patterns(pattern_id) deferrable initially deferred,
    FOREIGN KEY(stop_id) REFERENCES Transit_Stops(stop_id) deferrable initially deferred,
    FOREIGN KEY(link) REFERENCES Link(link) deferrable initially deferred
);

CREATE INDEX IF NOT EXISTS transit_pattern_mapping_stop_id ON Transit_Pattern_Mapping (stop_id);

SELECT AddGeometryColumn( 'Transit_Pattern_Mapping', 'geo', SRID_PARAMETER, 'LINESTRING', 'XY');

SELECT CreateSpatialIndex( 'Transit_Pattern_Mapping' , 'geo' );