MTC Roadway Schemas¶
MTC-specific roadway network schemas.
Extends Network Wrangler base schemas with MTC-required fields and validation rules.
COUNTY_NAME_TO_CENTROID_START_NUM = {MTCCounty.SAN_FRANCISCO.value: 0, MTCCounty.SAN_MATEO.value: 100000, MTCCounty.SANTA_CLARA.value: 200000, MTCCounty.ALAMEDA.value: 300000, MTCCounty.CONTRA_COSTA.value: 400000, MTCCounty.SOLANO.value: 500000, MTCCounty.NAPA.value: 600000, MTCCounty.SONOMA.value: 700000, MTCCounty.MARIN.value: 800000}
module-attribute
¶
Mapping of county names to centroid ID starting ranges.
https://bayareametro.github.io/tm2py/input/network/#county-node-numbering-system
COUNTY_NAME_TO_NODE_START_NUM = {MTCCounty.SAN_FRANCISCO.value: 1000000, MTCCounty.SAN_MATEO.value: 1500000, MTCCounty.SANTA_CLARA.value: 2000000, MTCCounty.ALAMEDA.value: 2500000, MTCCounty.CONTRA_COSTA.value: 3000000, MTCCounty.SOLANO.value: 3500000, MTCCounty.NAPA.value: 4000000, MTCCounty.SONOMA.value: 4500000, MTCCounty.MARIN.value: 5000000, MTCCounty.EXTERNAL.value: 900001}
module-attribute
¶
Mapping of county names to node ID starting ranges.
Each county is assigned a range of node IDs to ensure unique, non-overlapping identification across the MTC network. External nodes start at 900,001.
https://bayareametro.github.io/tm2py/input/network/#county-node-numbering-system
MTC_COUNTIES = tuple(county for county in (COUNTY_NAME_TO_NODE_START_NUM.keys()) if county != MTCCounty.EXTERNAL.value)
module-attribute
¶
Tuple of MTC county names in node ID range order (excludes External).
Contains the nine Bay Area counties ordered by their node ID ranges: ('San Francisco', 'San Mateo', 'Santa Clara', 'Alameda', 'Contra Costa', 'Solano', 'Napa', 'Sonoma', 'Marin')
COUNTY_NAME_TO_NUM = {county: (i + 1) for i, county in (enumerate(MTC_COUNTIES))}
module-attribute
¶
Mapping of county names to sequential numbers (1-9).
Counties are numbered based on their node ID range order: 1=San Francisco, 2=San Mateo, 3=Santa Clara, 4=Alameda, 5=Contra Costa, 6=Solano, 7=Napa, 8=Sonoma, 9=Marin
MTCCounty
¶
Bases: str, Enum
Nine Bay Area counties in the MTC region.
Source code in models/mtc_roadway_schema.py
14 15 16 17 18 19 20 21 22 23 24 25 | |
ALAMEDA = 'Alameda'
class-attribute
instance-attribute
¶
CONTRA_COSTA = 'Contra Costa'
class-attribute
instance-attribute
¶
MARIN = 'Marin'
class-attribute
instance-attribute
¶
NAPA = 'Napa'
class-attribute
instance-attribute
¶
SAN_FRANCISCO = 'San Francisco'
class-attribute
instance-attribute
¶
SAN_MATEO = 'San Mateo'
class-attribute
instance-attribute
¶
SANTA_CLARA = 'Santa Clara'
class-attribute
instance-attribute
¶
SOLANO = 'Solano'
class-attribute
instance-attribute
¶
SONOMA = 'Sonoma'
class-attribute
instance-attribute
¶
EXTERNAL = 'External'
class-attribute
instance-attribute
¶
MTCFacilityType
¶
Bases: IntEnum
Functional class (ft) codes for highway assignment.
These codes are used to assign volume delay functions (VDF) in tm2py.
Reference: MTC Network Rebuild Requirements
| Code | Facility Type | Intention | Speed Limit | Example |
|---|---|---|---|---|
| 1 | Freeway | Move vehicles across counties | 50+ mph | I-80 |
| 2 | Expressway | Connect freeways to other freeways or business districts | 40-60 mph | San Tomas Expressway |
| 3 | Ramp | Connect arterials to freeways or expressways | 20-45 mph | Tassajara Road to I-580 |
| 4 | Divided Arterial | Move vehicles across cities | 35-50 mph | El Camino Real |
| 5 | Undivided Arterial | Move vehicles across cities | 35-45 mph | Ashby Ave |
| 6 | Collector | Collect traffic from local roads and deliver to arterials | 25-40 mph | Fruitvale Road |
| 7 | Local | Connect roads to homes | 20-35 mph | Lance Drive |
| 8 | Connector | Connects centroids; access/egress links for managed lanes | ?? | |
| 99 | Not Assigned | Service Road | 20 mph | Parking lot |
Key Characteristics:
- Controlled Access: Freeway (always), Expressway (sometimes), others (no)
- Turn Pockets/Lanes: Freeway/Expressway/Ramp (always/N/A), Arterials (nearly always), Collectors (sometimes), Local/Dummy (never)
- Physical Separation: Freeway/Expressway (always), Ramp/Divided Arterial (usually/nearly always), others (rarely/never)
- On-street Parking: Never for Freeway/Expressway/Ramp, sometimes for Arterials, usually/always for Collector/Local/Dummy
- Walkable: Never for Freeway/Ramp, rarely for Expressway, nearly always to always for Arterials/Collectors/Local/Dummy
Source code in models/mtc_roadway_schema.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
FREEWAY = 1
class-attribute
instance-attribute
¶
EXPRESSWAY = 2
class-attribute
instance-attribute
¶
RAMP = 3
class-attribute
instance-attribute
¶
DIVIDED_ARTERIAL = 4
class-attribute
instance-attribute
¶
UNDIVIDED_ARTERIAL = 5
class-attribute
instance-attribute
¶
COLLECTOR = 6
class-attribute
instance-attribute
¶
LOCAL = 7
class-attribute
instance-attribute
¶
CONNECTOR = 8
class-attribute
instance-attribute
¶
NOT_ASSIGNED = 99
class-attribute
instance-attribute
¶
MTCUseClass
¶
Bases: IntEnum
Vehicle-class restrictions classification codes.
Used to define link access restrictions (auto-only, HOV only, etc.) in highway assignment.
Source code in models/mtc_roadway_schema.py
124 125 126 127 128 129 130 131 132 133 | |
MTCRoadLinksTable
¶
Bases: RoadLinksTable
MTC-specific roadway links table with additional required fields.
Extends the base RoadLinksTable from Network Wrangler with MTC-specific attributes required for Bay Area transportation modeling and highway assignment.
Additional Required Fields
county: County name (must be one of the 9 Bay Area counties) ft: Functional class (used to assign volume delay functions) useclass: Vehicle-class restrictions classification (auto-only, HOV only, etc.) tollbooth: Toll booth location indicator (bridge vs value toll) tollseg: Toll segment index for toll value lookups
Source code in models/mtc_roadway_schema.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
county: Series[str] = Field(coerce=True, nullable=False)
class-attribute
instance-attribute
¶
ft: Optional[Series[int]] = Field(coerce=True, nullable=True, default=None)
class-attribute
instance-attribute
¶
useclass: Optional[Series[int]] = Field(coerce=True, nullable=True, default=None)
class-attribute
instance-attribute
¶
tollbooth: Optional[Series[int]] = Field(coerce=True, nullable=True, default=None)
class-attribute
instance-attribute
¶
tollseg: Optional[Series[int]] = Field(coerce=True, nullable=True, default=None)
class-attribute
instance-attribute
¶
Config
¶
Bases: Config
Inherit parent configuration settings.
Source code in models/mtc_roadway_schema.py
178 179 180 | |
check_valid_county(county: Series) -> Series[bool]
¶
Validate that county values are valid MTCCounty enum values.
Source code in models/mtc_roadway_schema.py
158 159 160 161 162 | |
check_valid_ft(ft: Series) -> Series[bool]
¶
Validate that ft values are valid MTCFacilityType enum values.
Source code in models/mtc_roadway_schema.py
164 165 166 167 168 169 | |
check_valid_useclass(useclass: Series) -> Series[bool]
¶
Validate that useclass values are valid MTCUseClass enum values.
Source code in models/mtc_roadway_schema.py
171 172 173 174 175 176 | |
MTCRoadNodesTable
¶
Bases: RoadNodesTable
MTC-specific roadway nodes table with additional required fields.
Extends the base RoadNodesTable from Network Wrangler with MTC-specific attributes required for Bay Area transportation modeling.
Additional Required Fields
county: County name (must be one of the 9 Bay Area counties) taz_centroid: Indicates if node is a TAZ (Traffic Analysis Zone) centroid maz_centroid: Indicates if node is a MAZ (Micro-zone) centroid
Source code in models/mtc_roadway_schema.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
county: Series[str] = Field(coerce=True, nullable=False)
class-attribute
instance-attribute
¶
taz_centroid: Series[bool] = Field(coerce=True, nullable=False)
class-attribute
instance-attribute
¶
maz_centroid: Series[bool] = Field(coerce=True, nullable=False)
class-attribute
instance-attribute
¶
Config
¶
Bases: Config
Inherit parent configuration settings.
Source code in models/mtc_roadway_schema.py
206 207 208 | |
check_valid_county(county: Series) -> Series[bool]
¶
Validate that county values are valid MTCCounty enum values.
Source code in models/mtc_roadway_schema.py
200 201 202 203 204 | |