Public Transit API Developer's Guide

Transit Lines Details at a Station

User Story

The user wants to retrieve details of the transit lines going through a particular station, such as the Quincy/Wells station in Chicago (stnId=720390303).

Request

The query parameter stnId can be obtained by making a station search request, by name or by geocoordinates, for example Search for Transit Stations by Name.

https://cit.transit.api.here.com/v3/lines/by_stn_id.json
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&stnId=720390303
&graph=1

Response

The response to the request contains the following information blocks:
  • a maximum of 10 transit lines by default, can be configured using the optional max parameter
  • each line element includes the information about the line's properties and segments:
    • name, direction, and transit mode of the line
    • list of segment IDs of the main segment and all segments of the line
{
  Res: {
    serviceUrl: "http://search.st.transit.api.here.com/t0k2/lines",
    LineInfos: {
      LineInfo: [{
        Transport: {
          name: "8",
          dir: "Southgate Mall",
          mode: 5,
          At: {
            color: "#F3C727",
            textColor: "#000000"
          }
        },
        LineSegments: [{
          type: "main",
          seg_ids: "0 2 34 35 37 38 39 40 41 42 43 44 45 46 47 6 7 8 9 10 11 12 13 14 15 16 17 18 19 56"
        },
        {
          type: "all",
          seg_ids: "0 2 6 7 8 9 10 11 12 13 14 15 16 17 18 19 34 35 37 38 39 40 41 42 43 44 45 46 47 56"
        }]
      }]
    },
    PathSegments: {
      PathSeg: [{
        id: "0",
        runs: "21",
        duration: "PT0H1M0S",
        from: "720390000",
        to: "720390016",
        graph: "46.873711,-113.99567 46.8735766,-113.99519 46.8735552,-113.99496 46.872782,-113.99232"
      },
      {
        id: "1",
        runs: "21",
        duration: "PT0H1M0S",
        from: "720390015",
        to: "720390159",
        graph: "46.8455809,-114.02622 46.8465185,-114.02622 46.8467546,-114.02645 46.8477952,-114.02645 46.8484604,-114.0262 46.8488467,-114.02622 46.8488395,-114.02736"
      },
      {
        id: "2",
        runs: "21",
        duration: "PT0H1M0S",
        from: "720390016",
        to: "720390294",
        graph: "46.872782,-113.99232 46.8726861,-113.99199 46.8716884,-113.99262 46.8711341,-113.9908"
      },
      
      ... more lines ...
      
      },
      {
        id: "56",
        runs: "21",
        duration: "PT0H5M0S",
        from: "720390501",
        to: "720390329",
        graph: "46.8440029,-114.03002 46.8439972,-114.02614 46.8446517,-114.02514 46.8451023,-114.02577 46.8454671,-114.02622 46.8455809,-114.02622"
      }],
      RefPathSeg: [{
        id: "24",
        runs: "21",
        duration: "PT0H1M0S",
        seg_id: "17",
        reverse: 1
      }]
    },
    Stations: {
      Stn: [{
        id: "720390000",
        name: "Mountain Line Transfer Center",
        x: -113.9956,
        y: 46.873797
      },
      {
        id: "720390015",
        name: "Southgate Mall",
        x: -114.02617,
        y: 46.845581
      },
      {
        id: "720390329",
        name: "Southgate Mall",
        x: -114.02632,
        y: 46.845581
      },
      
      ... more lines ...
      
      {
        id: "720390300",
        name: "S 5th St W & Myrtle St",
        x: -113.99877,
        y: 46.865042
      },
      {
        id: "720390301",
        name: "S 5th St W & Chestnut St",
        x: -114.00185,
        y: 46.86505
      }]
    }
  }
}

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on selfservesupport@here.com.