How to search Stations by name and location
User story
You want to search for stations within a certain distance from their current geographic location and whose name fully or partially matches a given station name.
Request
Search stations through a single GET request. The only required
parameter in specifies the center of the searching area which is
defined as a pair of WGS84 coordinates in the form
<latitude>,<longitude>. The optional parameter r specifies the
radius in meters specifies the size of the searching area. By default,
r=500. The name parameter is the station name or part of the name to
search for. It is composed of one or more space separated words. The
following request will search for stations within 500 meters from the
user location, and whose names contain cinquecento:
GET https://transit.hereapi.com/v8/stations?in=41.90123,12.50091&name=termini
Authorization: Bearer {TOKEN}Note
For more information on the currently available authentication methods, see the Identity & Access Management Developer Guide.
Response
The response to the request contains the following information blocks:
- a maximum of 25 station identifiers are allowed in a single query.
- each station element in the
stationsresponse object includes the following high-level elements:placewith station/stop information such as name, location, ID, type.transportswith information about the transports serving the station. Addreturn=transportin request to enable it.accessPointswith information about points that are used to access the station/stop.
{
"stations": [
{
"place": {
"name": "Termini (MA-MB-FS)",
"type": "station",
"location": {
"lat": 41.901125,
"lng": 12.50042
},
"id": "415710072"
}
},
{
"place": {
"name": "Roma Termini",
"type": "station",
"location": {
"lat": 41.900503,
"lng": 12.502027
},
"id": "722068214"
}
},
{
"place": {
"name": "Termini (MA-MB-FS)",
"type": "station",
"location": {
"lat": 41.900662,
"lng": 12.500125
},
"id": "415712166"
}
},
{
"place": {
"name": "Termini",
"type": "station",
"location": {
"lat": 41.900965,
"lng": 12.499871
},
"id": "415712552"
}
},
{
"place": {
"name": "De Nicola/Termini",
"type": "station",
"location": {
"lat": 41.902722,
"lng": 12.499617
},
"id": "415703293"
},
"accessPoints": [
{
"location": {
"lat": 41.901298,
"lng": 12.500427
},
"name": "West Entrance",
"type": "accessPoint"
},
{
"location": {
"lat": 41.901299,
"lng": 12.500429
},
"name": "Piazza Mall",
"type": "accessPoint"
}
]
}
]
}Updated 14 days ago