Stop finder (coord) api issue

Hey guys, Im trying to use the stop finder api (using coord) to find all the bus stops and stations near a coordinate, and in the return data set it returns an array of locations and they are all of type platform. The issue Im having is I need to be able to tell between bus locations and train locations but there doesnt seem to be a clean way to do it.

I could do a check if the location name contains the string “Station” but thats really hacky.

I’d appreciate if someone could point me in the right direction
Thanks
Joey

1 Like

Hi Joey,
Are you using /stop_finder or /coord?

If you’re using stop finder look for “modes”:

  "coord": [
    -33.90721,
    151.18067
  ],
  "type": "stop",
  "matchQuality": 1000,
  "isBest": true,
  "modes": [
    1
     ]

1 = Trains, 4 = tram, 5 = bus, 7 = coach, 9 = ferry

/coord doesn’t have the same option but you do get a stop id which you could call stop_finder with. This works OK for small stations and bus stops but once you hit central stop finder just lists all modes. I’ve had a play but I can’t seem to improve the result.

It’s a bit round about but you could do the following:

  1. Call /coord ,get the stop id:

    “parent”: {
    “disassembledName”: “Central Station, Platform 12”,
    “name”: “Sydney, Central Station, Platform 12”,
    “id”: “2000332”,
    “isGlobalId”: true,
    “type”: “stop”,
    “parent”: {
    “id”: “95301001|1”,
    “name”: “Sydney”,
    “type”: “locality”
    }
    },

  2. Call /departure_mon with the ID from the last call and ensure nameKey_dm=$USEPOINT$ (this is really important as it ties the results to exact stop).

  3. In the return message look for iconId under product.

    “transportation”: {
    “id”: “nsw:020T2:A:H:sj2”,
    “name”: “Sydney Trains Networ T2 Airport, Inner West & South Line”,
    “disassembledName”: “T2”,
    “number”: “T2 Airport, Inner West & South Line”,
    “iconId”: 1,
    “description”: “City to Macarthur via Airport or Sydenham”,
    “product”: {
    “class”: 1,
    “name”: “Sydney Trains Networ”,
    “iconId”: 1
    },
    “operator”: {
    “id”: “x0001”,
    “name”: “Sydney Trains”
    },

These should be 1 = Trains, 4 = tram, 5 = bus, 7 = coach, 9 = ferry. The id at the higher level describes the operator.

I’m sure someone has a better way of doing this. If so please post.

Thanks for your quick response, yea I was using the /coord one and I did try the stop_finder but found the same issue where some of the location returns multiple modes in it.

I was thinking about doing something similar to your work around but yea its a bit too round about. And having to make multiple requests is not very efficient esp when it’s from a mobile app.

Im not sure if there’s a better way to do it, there doesnt seem to be a lot of docmentation for the apis. Just wondering where did you get this “1 = Trains, 4 = tram, 5 = bus, 7 = coach, 9 = ferry” from, I didnt seem to be able to find it in the Trip_Planner api technical documentation.

The documentation you have is the same one we use internally so I can’t give you anything other that what’s in my own head unfortunately. If you search for Elektronische Fahrplanauskunft or EFA usually you can look at other peoples projects in places like github. There are many versions of this engine around the world so YMMV. I think about half of the additional parameters I found worked but I still found it helpful.

The modes are listed in the swagger under /trip but I’ll post a spreadsheet with more detail in a new thread.