Public Transit API Developer's Guide

Transit Route

Note: This service is subject to Terms and Conditions as described in Supplier Terms for Developers Using HERE Location Platform APIs.

To find a transit route from the Hong Kong Coliseum to the Sham Shui Po Park using public transit, send the following GET request:

https://transit.hereapi.cn/v3/route.json
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&routing=all
&dep=22.301982,114.182154
&arr=22.330432,114.157929
&time=2019-06-24T07%3A30%3A00

The response to the above request includes the following high level elements:

  • a total of 3 transit connections or journeys
  • each journey includes the following information:
    • multiple transit segments with each segment (representing either a pedestrian or a transit segment) containing departure/arrival times, duration and coordinates
    • frequency of next 3 departures
    • the transit segment shows the actual stops or stations of departure, arrival and all intermediate stops in between
  • a set of operators who run the services included in the journeys, including operator code, operator name and links to operator websites, if any
{
  "Res": {
    "Connections": {
      "Connection": [
        {
          "Arr": {
            "Addr": {
              "x": 114.157929,
              "y": 22.330432
            },
            "time": "2019-06-24T07:57:00"
          },
          "Dep": {
            "Addr": {
              "x": 114.182154,
              "y": 22.301982
            },
            "time": "2019-06-24T07:30:00"
          },
          "Sections": {
            "Sec": [
              {
                "Arr": {
                  "Stn": {
                    "id": "411406581",
                    "name": "Jordan Station",
                    "x": 114.176577,
                    "y": 22.302085
                  },
                  "time": "2019-06-24T07:42:00"
                },
                "Dep": {
                  "Addr": {
                    "x": 114.182154,
                    "y": 22.301982
                  },
                  "Transport": {
                    "mode": 20
                  },
                  "time": "2019-06-24T07:30:00"
                },
                "Journey": {
                  "distance": 717,
                  "duration": "PT12M"
                },
                "id": "R00252d-C0-S0",
                "mode": 20
              },
              {
                "Arr": {
                  "Stn": {
                    "id": "411400089",
                    "name": "Cheung Sha Wan Playground",
                    "x": 114.160882,
                    "y": 22.332875
                  },
                  "time": "2019-06-24T07:49:00"
                },
                "Dep": {
                  "Freq": {
                    "AltDep": [
                      {
                        "Transport": {
                          "At": {
                            "category": "Bus",
                            "operator": "acn02100"
                          },
                          "dir": "\u5f00\u5f80 \u6a5f\u5834(\u5730\u9762\u904b\u53c1\u4e2d\u5fc3) \u65b9\u5411",
                          "mode": 5,
                          "name": "Citybus N21A"
                        },
                        "time": "2019-06-24T07:52:00"
                      },
                      {
                        "Transport": {
                          "At": {
                            "category": "Bus",
                            "operator": "acn02100"
                          },
                          "dir": "\u5f00\u5f80 \u6a5f\u5834(\u5730\u9762\u904b\u53c1\u4e2d\u5fc3) \u65b9\u5411",
                          "mode": 5,
                          "name": "Citybus N21A"
                        },
                        "time": "2019-06-24T08:02:00"
                      }
                    ],
                    "max": 10,
                    "min": 10
                  },
                  "Stn": {
                    "id": "411406581",
                    "name": "Jordan Station",
                    "x": 114.176577,
                    "y": 22.302085
                  },
                  "Transport": {
                    "At": {
                      "category": "Bus",
                      "operator": "acn02100"
                    },
                    "dir": "\u5f00\u5f80 \u6a5f\u5834(\u5730\u9762\u904b\u53c1\u4e2d\u5fc3) \u65b9\u5411",
                    "mode": 5,
                    "name": "Citybus N21A"
                  },
                  "time": "2019-06-24T07:42:00"
                },
                "Journey": {
                  "Stop": [
                    {
                      "Stn": {
                        "id": "411406581",
                        "name": "Jordan Station",
                        "x": 114.176577,
                        "y": 22.302085
                      },
                      "dep": "2019-06-24T07:42:00"
                    },
                    {
                      "Stn": {
                        "id": "411400892",
                        "name": "Nanking St",
                        "x": 114.176448,
                        "y": 22.30353
                      },
                      "dep": "2019-06-24T07:42:00"
                    },
                    {
                      "Stn": {
                        "id": "411405052",
                        "name": "Public Square St",
                        "x": 114.175991,
                        "y": 22.307987
                      },
                      "dep": "2019-06-24T07:43:00"
                    },
                    {
                      "Stn": {
                        "id": "411409930",
                        "name": "Pitt Street",
                        "x": 114.175381,
                        "y": 22.311209
                      },
                      "dep": "2019-06-24T07:44:00"
                    },
                    {
                      "Stn": {
                        "id": "411406259",
                        "name": "Cheung Sha Street",
                        "x": 114.17502,
                        "y": 22.312947
                      },
                      "dep": "2019-06-24T07:44:00"
                    },
                    {
                      "Stn": {
                        "id": "411403539",
                        "name": "Grand Tower",
                        "x": 114.174565,
                        "y": 22.315169
                      },
                      "dep": "2019-06-24T07:45:00"
                    },
                    {
                      "Stn": {
                        "id": "411404622",
                        "name": "Bute St",
                        "x": 114.173773,
                        "y": 22.31896
                      },
                      "dep": "2019-06-24T07:45:00"
                    },
                    {
                      "Stn": {
                        "id": "411403513",
                        "name": "Prince Edward Station",
                        "x": 114.172936,
                        "y": 22.323089
                      },
                      "dep": "2019-06-24T07:46:00"
                    },
                    {
                      "Stn": {
                        "id": "411406362",
                        "name": "Maple St",
                        "x": 114.170498,
                        "y": 22.325411
                      },
                      "dep": "2019-06-24T07:46:00"
                    },
                    {
                      "Stn": {
                        "id": "411406743",
                        "name": "Wong Chuk Street",
                        "x": 114.169723,
                        "y": 22.32604
                      },
                      "dep": "2019-06-24T07:47:00"
                    },
                    {
                      "Stn": {
                        "id": "411401926",
                        "name": "Pei Ho Street",
                        "x": 114.167174,
                        "y": 22.328032
                      },
                      "dep": "2019-06-24T07:48:00"
                    },
                    {
                      "Stn": {
                        "id": "411404949",
                        "name": "Yen Chow Street",
                        "x": 114.166332,
                        "y": 22.328683
                      },
                      "dep": "2019-06-24T07:48:00"
                    },
                    {
                      "Stn": {
                        "id": "411408473",
                        "name": "Yee Kok Court",
                        "x": 114.163918,
                        "y": 22.330581
                      },
                      "dep": "2019-06-24T07:49:00"
                    },
                    {
                      "Stn": {
                        "id": "411400089",
                        "name": "Cheung Sha Wan Playground",
                        "x": 114.160882,
                        "y": 22.332875
                      },
                      "arr": "2019-06-24T07:49:00"
                    }
                  ],
                  "duration": "PT07M"
                },
                "id": "R00252d-C0-S1",
                "mode": 5
              },
              {
                "Arr": {
                  "Addr": {
                    "x": 114.157929,
                    "y": 22.330432
                  },
                  "time": "2019-06-24T07:57:00"
                },
                "Dep": {
                  "Stn": {
                    "id": "411400089",
                    "name": "Cheung Sha Wan Playground",
                    "x": 114.160882,
                    "y": 22.332875
                  },
                  "Transport": {
                    "mode": 20
                  },
                  "time": "2019-06-24T07:49:00"
                },
                "Journey": {
                  "distance": 508,
                  "duration": "PT08M"
                },
                "id": "R00252d-C0-S2",
                "mode": 20
              }
            ]
          },
          "duration": "PT27M",
          "id": "R00252d-C0",
          "transfers": 0
        },
        
    … more lines …

      ],
      "Operators": {
        "Op": [
          {
            "code": "acn07000",
            "name": "\u9999\u6e2f\u9435\u8def\u6709\u9650\u516c\u53f8",
            "short_name": "070",
            "type": "TT"
          },
          {
            "code": "acn13800",
            "name": "\u6377\u8f1d\u6c7d\u53c1\u6709\u9650\u516c\u53f8",
            "short_name": "138",
            "type": "TT"
          },
          {
            "code": "acn02100",
            "name": "\u57ce\u5df4\u6709\u9650\u516c\u53f8",
            "short_name": "021",
            "type": "TT"
          }
        ]
      },
      "context": "rBSdXh1PV-N7AweyplhX4___AABwfBBdEv0C_9AHZABMghBdEv0",
      "valid_until": "2019-10-12"
    },
    "serviceUrl": "http://internal-ptkernel-prd-v010-1479417778.cn-northwest-1.elb.amazonaws.com.cn/goroute/HONG_KONG_SHIFTED_DEMO_V104_20181030"
  }
}