Bus occupany_status Values


#1

For the realtime bus vehicle position feed, there is a field called “occupany_status”. From memory the value I have seen so far are 0,1,2… etc. The GTFS spec says that the values are “empty”, “many_seats_available”… etc. Does this mean that the value 0 means “empty”, 1 means “many_seats_available”… and so on? Thanks.


#2

That should be right. You might want to check TfNSW’s proto file:

  // The degree of passenger occupancy of the vehicle. This field is still
  // experimental, and subject to change. It may be formally adopted in the
  // future.
  enum OccupancyStatus {
    // The vehicle is considered empty by most measures, and has few or no
    // passengers onboard, but is still accepting passengers.
    EMPTY = 0;

    // The vehicle has a relatively large percentage of seats available.
    // What percentage of free seats out of the total seats available is to be
    // considered large enough to fall into this category is determined at the
    // discretion of the producer.
    MANY_SEATS_AVAILABLE = 1;

    // The vehicle has a relatively small percentage of seats available.
    // What percentage of free seats out of the total seats available is to be
    // considered small enough to fall into this category is determined at the
    // discretion of the feed producer.
    FEW_SEATS_AVAILABLE = 2;

    // The vehicle can currently accommodate only standing passengers.
    STANDING_ROOM_ONLY = 3;

    // The vehicle can currently accommodate only standing passengers
    // and has limited space for them.
    CRUSHED_STANDING_ROOM_ONLY = 4;

    // The vehicle is considered full by most measures, but may still be
    // allowing passengers to board.
    FULL = 5;

    // The vehicle is not accepting additional passengers.
    NOT_ACCEPTING_PASSENGERS = 6;

  }
  optional OccupancyStatus occupancy_status = 9;

#3

Thanks, forgot about the proto file! :slight_smile:


#4

Someone mentioned that we may not have communicated that the 3 levels are now available… and have been for some time.

So you should see these three statuses in the feed:
MANY_SEATS_AVAILABLE
FEW_SEATS_AVAILABLE
STANDING_ROOM_ONLY

An example from the 14th Dec

trip {
  trip_id: "300556"
  start_time: "16:15:00"
  start_date: "20161214"
  schedule_relationship: SCHEDULED
  route_id: "2436_T66"
}
position {
  latitude: -33.8086662292
  longitude: 150.987350464
  bearing: 105.0
  speed: 0.0
}
timestamp: 1481695752
congestion_level: RUNNING_SMOOTHLY
vehicle {
  id: "33553_11581753_2436_T66_1"
  [transit_realtime.tfnsw_vehicle_descriptor] {
    air_conditioned: true
    wheelchair_accessible: 1
    special_vehicle_attributes: 0
  }
}
occupancy_status: MANY_SEATS_AVAILABLE
  }
}
 
entity {
  id: "33553_11582191_2436_T66_1"
  vehicle {
trip {
  trip_id: "353650"
  start_time: "16:50:00"
  start_date: "20161214"
  schedule_relationship: SCHEDULED
  route_id: "2436_T66"
}
position {
  latitude: -33.7970733643
  longitude: 150.985427856
  bearing: 332.0
  speed: 8.10000038147
}
timestamp: 1481695749
congestion_level: UNKNOWN_CONGESTION_LEVEL
vehicle {
  id: "33553_11582191_2436_T66_1"
  [transit_realtime.tfnsw_vehicle_descriptor] {
    air_conditioned: true
    wheelchair_accessible: 1
    special_vehicle_attributes: 0
  }
}
occupancy_status: FEW_SEATS_AVAILABLE
 
  vehicle {
trip {
  trip_id: "342433"
  start_time: "15:35:00"
  start_date: "20161214"
  schedule_relationship: SCHEDULED
  route_id: "2440_E65"
}
position {
  latitude: -33.823135376
  longitude: 151.242752075
  bearing: 50.0
  speed: 7.69999980927
}
timestamp: 1481695748
congestion_level: RUNNING_SMOOTHLY
vehicle {
  id: "11954_161103515_2440_E65_1"
  [transit_realtime.tfnsw_vehicle_descriptor] {
    air_conditioned: true
    wheelchair_accessible: 1
    special_vehicle_attributes: 0
  }
}
occupancy_status: STANDING_ROOM_ONLY
  }
}

#5

@yvonne.lee awesome! keen to know what the threshold value for FEW_SEATS_AVAILABLE is. Would be really useful for predictive modelling. :slight_smile:


#6

Hey @jxeeno this is what our team has provided

Occupancy is calculated based on the vehicle make/model capacity:

  • If occupancy on the bus is MORE THAN the seating capacity of the bus -----> “STANDING_ROOM_ONLY”
  • If occupancy on the bus is LESS THAN 50% of the seating capacity of the bus -----> “MANY_SEATS_AVAILABLE”
  • Else -----> “FEW_SEATS_AVAILABLE”

#7

Hello
Has this changed since 2016/2017? I am wanting to include bus occupancy in my app however when I query data now I get ‘MANY_SEATS’ returned rather than ‘MANY_SEATS_AVAILABLE’ What are the variables which could be returned now in 2018?


#8

Hi @iainbrew, this shouldn’t have changed. The occupancy status should still be provided by three values:

  • STANDING ROOM ONLY
  • MANY SEATS AVAILABLE
  • FEW SEATS AVAILABLE

Can you provide an exact example if you’ve found that’s not the case.

Thanks,
Alex


#9

Hi Alex
Here is an example (taken from a recent request):

“properties”: {
“occupancy”: “MANY_SEATS”


#10

Hi @iainbrew, I tried this using our API explorer and it’s showing the correct values, see below. Just curious as to how you’re calling the API or viewing the data?

image

Thanks,
Alex


#11

Hi Alex
I am using your API Explorer. For example:

curl -X GET --header ‘Accept: application/json’ --header ‘Authorization: apikey PUTKEYHERE’ ‘https://api.transport.nsw.gov.au/v1/tp/departure_mon?outputFormat=rapidJSON&coordOutputFormat=EPSG%3A4326&mode=direct&type_dm=stop&name_dm=2113250&nameKey_dm=%24USEPOINT%24&departureMonitorMacro=true&TfNSWDM=true&version=10.2.1.42

Here is a more detailed response:
{
“version”: “10.2.1.42”,
“systemMessages”: ,
“locations”: [
{
“id”: “10116373”,
“name”: “Macquarie University Campus Interchange, Macquarie Park”,
“disassembledName”: “Macquarie University Campus Interchange”,
“coord”: [
-33.77705,
151.11282
],
“type”: “stop”,
“matchQuality”: 100000,
“isBest”: false,
“parent”: {
“id”: “95352007|1”,
“name”: “Macquarie Park”,
“type”: “locality”
},
“assignedStops”: [
{
“id”: “10116373”,
“name”: “Macquarie University Campus Interchange, Macquarie Park”,
“disassembledName”: “Macquarie University Campus Interchange”,
“type”: “stop”,
“coord”: [
-33.77705,
151.11282
],
“parent”: {
“name”: “Macquarie Park”,
“type”: “locality”
},
“modes”: [
5,
11
],
“connectingMode”: 100
}
]
}
],
“stopEvents”: [
{
“isRealtimeControlled”: true,
“location”: {
“id”: “2113250”,
“isGlobalId”: true,
“name”: “Macquarie Park, Macquarie University Campus, University Ave, Stand A”,
“type”: “platform”,
“coord”: [
-33.77694,
151.11398
],
“properties”: {
“occupancy”: “MANY_SEATS”
},
“parent”: {
“id”: “10116373”,
“name”: “Macquarie Park, Macquarie University Campus, University Ave, Stand A”,
“disassembledName”: “Macquarie University Campus, University Ave, Stand A”,
“type”: “stop”,
“parent”: {
“id”: “95352007|1”,
“name”: “Macquarie Park”,
“type”: “locality”
}
}
},
“departureTimePlanned”: “2018-11-14T00:35:00Z”,
“departureTimeEstimated”: “2018-11-14T00:35:00Z”,
“transportation”: {
“id”: “nsw:26518: :R:sj2”,
“name”: “Sydney Buses Network 518”,
“disassembledName”: “518”,
“number”: “518”,
“iconId”: 5,
“description”: “Macquarie University to City Circular Quay”,
“product”: {
“class”: 5,
“name”: “Sydney Buses Network”,
“iconId”: 5
},
“operator”: {
“id”: “2439”,
“name”: “State Transit”
},
“destination”: {
“name”: “City Circular Quay”,
“type”: “stop”
},
“properties”: {
“tripCode”: 24,
“mtSubcode”: “0”
},
“origin”: {
“name”: “Macquarie University Campus Interchange, Macquarie Park”,
“type”: “stop”
}
},
“infos”: [
{
“timestamps”: {
“creation”: “2018-03-28T03:07:00Z”,
“lastModification”: “2018-08-01T06:25:00Z”
},
“priority”: “veryLow”,
“id”: “6018568”,
“version”: “6”,
“urlText”: “This is an Opal only service”,
“url”: “http://localhost:8085/ics/XSLT_CM_SHOWADDINFO_REQUEST?infoID=6018568&seqID=6”,
“content”: “No tickets are sold on board this bus. You need a valid <a href=“https://transportnsw.info/tickets-opal/opal/get-opal-card”>Opal card to travel on this service.”,
“subtitle”: “This is an Opal only service”
}
],
“properties”: {
“WheelchairAccess”: “true”,
“RealtimeTripId”: “693364”,
“AVMSTripID”: “693364”,
“PlanLowFloorVehicle”: “1”,
“PlanWheelChairAccess”: “1”
}
},
{
“location”: {
“id”: “2113250”,
“isGlobalId”: true,
“name”: “Macquarie Park, Macquarie University Campus, University Ave, Stand A”,
“type”: “platform”,
“coord”: [
-33.77694,
151.11398
],
“parent”: {
“id”: “10116373”,
“name”: “Macquarie Park, Macquarie University Campus, University Ave, Stand A”,
“disassembledName”: “Macquarie University Campus, University Ave, Stand A”,
“type”: “stop”,
“parent”: {
“id”: “95352007|1”,
“name”: “Macquarie Park”,
“type”: “locality”
}
}
},
“departureTimePlanned”: “2018-11-14T00:36:00Z”,
“transportation”: {
“id”: “nsw:26288: :R:sj2”,
“name”: “Sydney Buses Network 288”,
“disassembledName”: “288”,
“number”: “288”,
“iconId”: 5,
“description”: “Epping to City Erskine St”,
“product”: {
“class”: 5,
“name”: “Sydney Buses Network”,
“iconId”: 5
},
“operator”: {
“id”: “2439”,
“name”: “State Transit”
},
“destination”: {
“name”: “City Sussex St”,
“type”: “stop”
},
“properties”: {
“tripCode”: 59,
“mtSubcode”: “0”
},
“origin”: {
“name”: “Epping Station”,
“type”: “stop”
}
},
“infos”: [
{
“timestamps”: {
“creation”: “2018-03-28T03:07:00Z”,
“lastModification”: “2018-08-01T06:25:00Z”
},
“priority”: “veryLow”,
“id”: “6018568”,
“version”: “6”,
“urlText”: “This is an Opal only service”,
“url”: “http://localhost:8085/ics/XSLT_CM_SHOWADDINFO_REQUEST?infoID=6018568&seqID=6”,
“content”: “No tickets are sold on board this bus. You need a valid <a href=“https://transportnsw.info/tickets-opal/opal/get-opal-card”>Opal card to travel on this service.”,
“subtitle”: “This is an Opal only service”
}
],
“properties”: {
“WheelchairAccess”: “true”,
“RealtimeTripId”: “790797”,
“PlanLowFloorVehicle”: “1”,
“PlanWheelChairAccess”: “1”
}
},
{
“isRealtimeControlled”: true,
“location”: {
“id”: “2113250”,
“isGlobalId”: true,
“name”: “Macquarie Park, Macquarie University Campus, University Ave, Stand A”,
“type”: “platform”,
“coord”: [
-33.77694,
151.11398
],
“properties”: {
“occupancy”: “MANY_SEATS”
},
“parent”: {
“id”: “10116373”,
“name”: “Macquarie Park, Macquarie University Campus, University Ave, Stand A”,
“disassembledName”: “Macquarie University Campus, University Ave, Stand A”,
“type”: “stop”,
“parent”: {
“id”: “95352007|1”,
“name”: “Macquarie Park”,
“type”: “locality”
}
}
},
“departureTimePlanned”: “2018-11-14T00:40:00Z”,
“departureTimeEstimated”: “2018-11-14T00:41:00Z”,
“transportation”: {
“id”: “nsw:26506: :R:sj2”,
“name”: “Sydney Buses Network 506”,
“disassembledName”: “506”,
“number”: “506”,
“iconId”: 5,
“description”: “Macquarie University to City Domain via East Ryde”,
“product”: {
“class”: 5,
“name”: “Sydney Buses Network”,
“iconId”: 5
},
“operator”: {
“id”: “2439”,
“name”: “State Transit”
},
“destination”: {
“name”: “City The Domain”,
“type”: “stop”
},
“properties”: {
“tripCode”: 171,
“mtSubcode”: “0”
},
“origin”: {
“name”: “Macquarie University Campus Interchange, Macquarie Park”,
“type”: “stop”
}
},
“infos”: [
{
“timestamps”: {
“creation”: “2018-03-28T03:07:00Z”,
“lastModification”: “2018-08-01T06:25:00Z”
},
“priority”: “veryLow”,
“id”: “6018568”,
“version”: “6”,
“urlText”: “This is an Opal only service”,
“url”: “http://localhost:8085/ics/XSLT_CM_SHOWADDINFO_REQUEST?infoID=6018568&seqID=6”,
“content”: “No tickets are sold on board this bus. You need a valid <a href=“https://transportnsw.info/tickets-opal/opal/get-opal-card”>Opal card to travel on this service.”,
“subtitle”: “This is an Opal only service”
}
],
“properties”: {
“WheelchairAccess”: “true”,
“RealtimeTripId”: “692740”,
“AVMSTripID”: “692740”,
“PlanLowFloorVehicle”: “1”,
“PlanWheelChairAccess”: “1”
}
},


#12

Hi @iainbrew, apologies about that, let me clarify. The screenshot I showed you was from the real-time vehicle position API that shows occupancy too. The Trip Planner API has a slightly different output but you can just assume that “MANY_SEATS” = “MANY_SEATS_AVAILABLE”.

The Vehicle Position API gives you the occupancy for a vehicle at that point in time in real-time. The Trip Planner API predicts what the occupancy will be for that stop. The Trip Planner API values are:

  • STANDING_ONLY
  • FEW_SEATS
  • MANY_SEATS

Like I said you can assume that the values correspond to the values in the Vehicle Position API but we will update the Trip Planner API documentation soon with further clarification.

Thanks,
Alex


#13

Thanks Alex
Also a shout out to jxeeno who inspired this. In less than a week I have a prototype now for displaying bus stop info on our campus in real time.


#14

Looking nice @iainbrew!