connection table structure

connection table structure#

The connections table lists the possible turns from one link into another (or itself). It specifies the lane(s) in the origin and destination links that are connected, as well as the detail of topological direction in each link that corresponds to that connection.

Geometry information is provided solely for visualization purposes

Table Structure#

Field

Type

NULL allowed

Default Value

Foreign key

Description

conn*

INTEGER

NO

link

INTEGER

YES

Link(link)

bidirectional link for the upstream link of the connection

dir

INTEGER

NO

0

direction (0 for ab, 1 for ba) of the upstream link of the connection

node

INTEGER

YES

Node(node)

incident node of the connection (set by POLARIS)

to_link

INTEGER

NO

Link(to_link)

downstream bidirectinal link of the connection

to_dir

INTEGER

YES

direction (1 for ab, 1 for ba) of the downstream link of the connection

lanes

TEXT

NO

‘’

number of lanes in the upstream link that can be used for the connection (not used for all models)

to_lanes

TEXT

NO

‘’

number of lanes in the downstream link that can be used for the connection (not used for all models)

type

TEXT

NO

‘’

movement type (THRU, RIGHT, LEFT, UTURN)

penalty

INTEGER

NO

0

Not used by POLARIS

speed

REAL

YES

0

Not used by POLARIS

capacity

INTEGER

NO

0

Not used by POLARIS

in_high

INTEGER

NO

0

Not used by POLARIS

out_high

INTEGER

NO

0

Not used by POLARIS

approximation

TEXT

NO

‘’

directional approximation SB (southbound), EB, NB or WB

geo

LINESTRING

YES

(* - Primary key)

The SQL statement for table and index creation is below.

CREATE TABLE IF NOT EXISTS "Connection" (
    "conn"        INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
    "link"        INTEGER,
    "dir"         INTEGER NOT NULL DEFAULT 0,
    "node"        INTEGER,
    "to_link"     INTEGER NOT NULL,
    "to_dir"      INTEGER,
    "lanes"       TEXT    NOT NULL DEFAULT '',
    "to_lanes"    TEXT    NOT NULL DEFAULT '',
    "type"        TEXT    NOT NULL DEFAULT '',
    "penalty"     INTEGER NOT NULL DEFAULT 0,
    "speed"       REAL             DEFAULT 0,
    "capacity"    INTEGER NOT NULL DEFAULT 0,
    "in_high"     INTEGER NOT NULL DEFAULT 0,
    "out_high"    INTEGER NOT NULL DEFAULT 0,
    approximation TEXT    NOT NULL DEFAULT '',
    CONSTRAINT "link_fk" FOREIGN KEY("link") REFERENCES "Link"("link") ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
    CONSTRAINT "to_link_fk" FOREIGN KEY("to_link") REFERENCES "Link"("link") ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
    CONSTRAINT "node_fk" FOREIGN KEY("node") REFERENCES "Node"("node") ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED
);

SELECT AddGeometryColumn( 'Connection', 'geo', SRID_PARAMETER, 'LINESTRING', 'XY');
SELECT CreateSpatialIndex( 'Connection' , 'geo' );

create INDEX IF NOT EXISTS "idx_conn_node" ON "Connection" ("node");
create INDEX IF NOT EXISTS "idx_conn_lanes" ON "Connection" ("lanes");
create INDEX IF NOT EXISTS "idx_conn_to_lanes" ON "Connection" ("to_lanes");
create INDEX IF NOT EXISTS "idx_conn_link" ON "Connection" ("link");
create INDEX IF NOT EXISTS "idx_conn_to_link" ON "Connection" ("to_link");