- Previous: Method 3: Rail Station Info
- Up: Description of Methods
- Next: Method 5: Rail Station Prediction
Method 4: Rail Paths
Description: Returns a list of stations between two given stations.
Examples
url (REST) : http://api.wmata.com/Rail.svc/Path?FromStationCode=A10&ToStationCode=A12&api_key=YOUR_API_KEY - build path between A10 and A12
url (JSON): http://api.wmata.com/Rail.svc/json/JPath?FromStationCode=A10&ToStationCode=B05&api_key=YOUR_API_KEY
Response example (REST):
<PathResp xmlns="http://www.wmata.com" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <Path> <MetroPathItem> <DistanceToPrev>0</DistanceToPrev> <LineCode>RD</LineCode> <SeqNum>1</SeqNum> <StationCode>A10</StationCode> <StationName>Medical Center</StationName> </MetroPathItem> <MetroPathItem> <DistanceToPrev>11821</DistanceToPrev> <LineCode>RD</LineCode> <SeqNum>2</SeqNum> <StationCode>A11</StationCode> <StationName>Grosvenor</StationName> </MetroPathItem> <MetroPathItem> <DistanceToPrev>7309</DistanceToPrev> <LineCode>RD</LineCode> <SeqNum>3</SeqNum> <StationCode>A12</StationCode> <StationName>White Flint</StationName> </MetroPathItem> </Path> </PathResp>
Description of response fields:
- StationCode - The ID code for an individual station.
- StationName - The name of the Station.
- LineCode - The ID (color) of the Line associated with the path. Can be RD, BL, YL, OR, GR
- SeqNum - The sequence of the station in the path.
- DistanceToPrev - Distance in feet from the previous station in the path.
Docs Navigation
- Description of Methods
- Method 1: Rail Lines
- Method 2: Rail Stations
- Method 3: Rail Station Info
- Method 4: Rail Paths
- Method 5: Rail Station Prediction
- Method 6: Rail Incidents
- Method 7: Elevator / Elevator Incidents
- Method 8: Station Entrances
- Method 9: Bus Routes
- Method 10: Bus Stops
- Method 11: Bus Schedule by Route
- Method 12: Bus Route Details
- Method 13: Bus Positions
- Method 14: Bus Schedule by Stop
- Method 15: Bus Prediction
3 Comments
Tim Schmitz – 2 years ago
Any chance of returning an estimated travel time in the path response?
Peter Shashkin – 2 years ago
This would be a time-dependent request. Travel time in peak hours is different from regular hours. In my opinion, this is overkill for public interface (but I might be wrong). At this point I would recommend to gather some statistical info using our prediction service, and build your own repository of travel times.
As of this moment we're concentrating on exposing base services (like arrival info) as opposed to info derived from that (like statistics). However I do understand that traver times (under normal circumstances) can be helpful to developers.
skinnycat – 6 months ago
It would be nice if it was feasible to get rail paths from 2 different rail lines. Let's say get the rail path form Glenmont (red line) to Greenbelt (green line). I already done this programmatically but since I developing an Android app, this kind of operations are never good for battery life. I hope that my suggestion helps to improve the API.
Please sign in to post a comment.