Public Transit API v3 Developer's Guide

Transit Coverage

User Story

The user wants to retrieve a list of cities with a transit network near Boston (40.7510, 73.9916), and details of public transit operators working within those cities.

Request

The query parameter center specifies the location of the search.

https://transit.ls.hereapi.com/v3/coverage/city.json
?apiKey={YOUR_API_KEY}
&center=42.3580,-71.0636
Note: This example uses a HERE API Key to authenticate your request. For information on other possible options, see Authentication Guide. For examples of how to use the other authentication options with the Public Transit API v3, see Authentication Examples.

Response

The response to the request contains a list of cities with the following information:
  • name, longitude, and latitude for each city
  • distance in meters to the location in the request
  • country and state the city belongs to
  • number of transit lines and stops available in the city
  • operators providing the transit service in the city
{
  "Res": {
    "serviceUrl": "https://transit.ls.hereapi.com/transit/v3/coverage/city.json",
    "Coverage": {
      "ref_time": "2017-03-01T11:20:23",
      "CityCount": {
        "TT": 559,
        "RT": 11,
        "SR": 160
      },
      "Cities": {
        "City": [
          {
            "updated": "2016-11-23T16:46:26",
            "name": "Boston",
            "created": "2016-11-23T16:46:26",
            "country": "United States",
            "state": "Massachusetts",
            "y": 42.35866,
            "x": -71.05674,
            "id": "drt2z",
            "display_name": "Boston, Massachusetts, USA",
            "distance": 568,
            "relevancy": 0.95,
            "Cvg": {
              "quality": 0.67,
              "lines": 283,
              "stops": 2126
            },
            "Operators": {
              "Op": [
                {
                  "name": "Plymouth & Brockton Street Railway Co.",
                  "type": "TT",
                  "code": "55y0PB00",
                  "Link": [
                    {
                      "id": "website",
                      "href": "http://www.p-b.com/",
                      "text": "Plymouth & Brockton Street Railway Co."
                    }
                  ],
                  "At": {
                    "phone": "508-746-0378"
                  }
                },
                {
                  "name": "Brockton Area Transit Authority",
                  "type": "TT",
                  "code": "4AD44400",
                  "Link": [
                    {
                      "id": "website",
                      "href": "http://www.ridebat.com/",
                      "text": "Brockton Area Transit Authority"
                    }
                  ],
                  "At": {
                    "phone": "508-588-1000"
                  }
                },

                ... more links ...

                {
                  "name": "Salem Ferry",
                  "type": "TT",
                  "code": "4APSAL00",
                  "Link": [
                    {
                      "id": "website",
                      "href": "http://www.salemferry.com/",
                      "text": "Salem Ferry"
                    }
                  ]
                }
              ]
            },
            "pop": 599351
          },
          {
            "updated": "2016-11-23T16:46:26",
            "name": "Cambridge",
            "created": "2016-11-23T16:46:26",
            "country": "United States",
            "state": "Massachusetts",
            "y": 42.36679,
            "x": -71.10601,
            "id": "drt3j",
            "display_name": "Cambridge, Massachusetts, USA",
            "distance": 3616,
            "relevancy": 0.0,
            "Cvg": {
              "quality": 0.8,
              "lines": 43,
              "stops": 271
            },
            "Operators": {
              "Op": [
                {
                  "name": "MBTA",
                  "type": "TT",
                  "code": "3QT00100",
                  "Link": [
                    {
                      "id": "website",
                      "href": "http://www.mbta.com",
                      "text": "MBTA"
                    }
                  ],
                  "At": {
                    "phone": "617-222-3200"
                  }
                },
                {
                  "name": "128 Business Council",
                  "type": "TT",
                  "code": "bH512800",
                  "Link": [
                    {
                      "id": "website",
                      "href": "http://www.128bc.org/",
                      "text": "128 Business Council"
                    }
                  ],
                  "At": {
                    "phone": "781-890-0093"
                  }
                }
              ]
            },
            "pop": 101388
          },

          ... more lines ...

          {
            "updated": "2016-11-23T16:46:26",
            "name": "Hartford",
            "created": "2016-11-23T16:46:26",
            "country": "United States",
            "state": "Connecticut",
            "y": 41.76349,
            "x": -72.67402,
            "id": "drkmd",
            "display_name": "Hartford, Connecticut, USA",
            "distance": 148379,
            "relevancy": 0.0,
            "Cvg": {
              "quality": 0.8,
              "lines": 66,
              "stops": 1065
            },
            "Operators": {
              "Op": [
                {
                  "name": "Megabus",
                  "type": "TT",
                  "code": "gaW23100",
                  "Link": [
                    {
                      "id": "website",
                      "href": "http://us.megabus.com/Default.aspx",
                      "text": "Megabus"
                    }
                  ],
                  "At": {
                    "phone": "1 (877) 462-6342"
                  }
                },
                {
                  "name": "CTTransit- Hartford",
                  "type": "TT",
                  "code": "43t15500",
                  "Link": [
                    {
                      "id": "website",
                      "href": "http://www.cttransit.com",
                      "text": "CTTransit- Hartford"
                    }
                  ],
                  "At": {
                    "phone": "860-525-9181"
                  }
                },
                {
                  "name": "CTTransit- New Britain-Bristol",
                  "type": "TT",
                  "code": "5wR00400",
                  "Link": [
                    {
                      "id": "website",
                      "href": "https://www.cttransit.com",
                      "text": "CTTransit- New Britain-Bristol"
                    }
                  ],
                  "At": {
                    "phone": "860-828-0512"
                  }
                },
                {
                  "name": "Peter Pan Bus Lines",
                  "type": "TT",
                  "code": "55tPet00",
                  "Link": [
                    {
                      "id": "website",
                      "href": "http://peterpanbus.com/",
                      "text": "Peter Pan Bus Lines"
                    }
                  ],
                  "At": {
                    "phone": "800-343-9999"
                  }
                }
              ]
            },
            "pop": 124563
          }
        ]
      }
    }
  }
}