Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop_code is not returned #2

Open
antrim opened this issue Oct 21, 2015 · 4 comments
Open

stop_code is not returned #2

antrim opened this issue Oct 21, 2015 · 4 comments

Comments

@antrim
Copy link
Collaborator

antrim commented Oct 21, 2015

stop_code is provided in the GTFS. I believe that OTP does provide this in planner results. We see null values in stop_code from otp-api-proxy.

Example
(http://gtfs-api.ed-groth.com/trip-planner/anaheim-ca-us/plan?fromPlace=33.8046480634388,-117.915358543396&toPlace=33.77272636987434,-117.8671646118164)

{
  "date" : 1445632140000,
  "from" : {
    "name" : "South Harbor Boulevard",
    "lon" : -117.91541338573779,
    "lat" : 33.80464805427682,
    "orig" : "",
    "vertexType" : "NORMAL"
  },
  "to" : {
    "name" : "Memory Lane",
    "lon" : -117.86715233781749,
    "lat" : 33.772752637963684,
    "orig" : "",
    "vertexType" : "NORMAL"
  },
  "itineraries" : [ {
    "waitingTime" : 2,
    "startTime" : 1445655025000,
    "endTime" : 1445658565000,
    "fare" : {
      "fare" : {
        "regular" : {
          "currency" : {
            "currency" : "USD",
            "defaultFractionDigits" : 2,
            "currencyCode" : "USD",
            "symbol" : "$"
          },
          "cents" : 300
        }
      }
    },
    "elevationGained" : 0.0,
    "duration" : 3540,
    "walkLimitExceeded" : false,
    "tooSloped" : false,
    "walkTime" : 2518,
    "walkDistance" : 728.187333303796,
    "legs" : [ {
      "rentedBike" : false,
      "departureDelay" : 0,
      "agencyTimeZoneOffset" : -25200000,
      "startTime" : 1445655025000,
      "endTime" : 1445655779000,
      "steps" : [ {
        "streetName" : "South Harbor Boulevard",
        "elevation" : [ ],
        "relativeDirection" : "DEPART",
        "absoluteDirection" : "SOUTH",
        "bogusName" : false,
        "lon" : -117.91541338573779,
        "lat" : 33.80464805427682,
        "stayOn" : false,
        "area" : false,
        "distance" : 173.92
      }, {
        "streetName" : "path",
        "elevation" : [ ],
        "relativeDirection" : "RIGHT",
        "absoluteDirection" : "WEST",
        "bogusName" : true,
        "lon" : -117.9153869,
        "lat" : 33.8030842,
        "stayOn" : false,
        "area" : false,
        "distance" : 40.760999999999996
      } ],
      "mode" : "WALK",
      "duration" : 754.0,
      "route" : "",
      "interlineWithPreviousLeg" : false,
      "legGeometry" : {
        "points" : "_nimEjjunUdA?|@?l@Aj@?ZA^?\\A?ZDCj@?",
        "length" : 11
      },
      "realTime" : false,
      "pathway" : false,
      "from" : {
        "name" : "South Harbor Boulevard",
        "lon" : -117.91541338573779,
        "lat" : 33.80464805427682,
        "departure" : 1445655025000,
        "orig" : "",
        "vertexType" : "NORMAL"
      },
      "distance" : 214.68099999999998,
      "transitLeg" : false,
      "arrivalDelay" : 0,
      "to" : {
        "departure" : 1445655780000,
        "arrival" : 1445655779000,
        "stopCode" : null,
        "name" : "Portofino Stop",
        "vertexType" : "TRANSIT",
        "stopId" : "248:778154",
        "lon" : -117.91547,
        "lat" : 33.80284,
        "stopIndex" : 1,
        "stopSequence" : 2
      }
    }, {
      "rentedBike" : false,
      "departureDelay" : 0,
      "agencyTimeZoneOffset" : -25200000,
      "startTime" : 1445655780000,
      "routeLongName" : "Santa Ana Line",
      "endTime" : 1445656800000,
      "steps" : [ ],
      "mode" : "BUS",
      "duration" : 1020.0,
      "route" : "19",
      "interlineWithPreviousLeg" : false,
      "legGeometry" : {
        "points" : "wbimEbjunU??dRM?lJQJAZNPTCNV@v@?nCHJR@F_AKoCGYYSEsKfUS?kV?u^uJHmOBqO@@gM`C@n@Od@a@\\sAJ{G^oArDuDl@|@PQFu@\\a@??FKYi@~FmGHUdR_SAkL?mUBwMCcL?}OHaAn@{EFoB?qK?mP@kOb@cEb@eB|@uBZiCBsNMoAYqBEy@Fi@vP?~OB|@Ph@h@b@d@f@^nAPtBB|MEhIDtLD|N@pG@pKBrOAIvGAtEAnAIn@Qh@q@l@}DtBcAuAd@u@EC[@OBW\\",
        "length" : 90
      },
      "agencyName" : "Anaheim Resort Transportation",
      "realTime" : false,
      "routeColor" : "2C0093",
      "serviceDate" : "20151023",
      "agencyUrl" : "http://www.rideart.org/",
      "routeUrl" : "http://rideart.org/routes-and-schedules/mainplace-line/",
      "pathway" : false,
      "routeHumanFrequency" : "See schedule",
      "headsign" : "Disneyland Resort",
      "from" : {
        "departure" : 1445655780000,
        "arrival" : 1445655779000,
        "stopCode" : null,
        "name" : "Portofino Stop",
        "vertexType" : "TRANSIT",
        "stopId" : "248:778154",
        "lon" : -117.91547,
        "lat" : 33.80284,
        "stopIndex" : 1,
        "stopSequence" : 2
      },
      "tripId" : "111260A1639B2933",
      "agencyId" : "248",
      "routeId" : "1713",
      "distance" : 5950.749039460567,
      "transitLeg" : true,
      "arrivalDelay" : 0,
      "routeTextColor" : "FFFFFF",
      "routeType" : 3,
      "routeShortName" : "19",
      "to" : {
        "departure" : 1445656801000,
        "arrival" : 1445656800000,
        "stopCode" : null,
        "name" : "Main St. & Mainplace Mall",
        "vertexType" : "TRANSIT",
        "stopId" : "248:780771",
        "lon" : -117.87105,
        "lat" : 33.77476,
        "stopIndex" : 4,
        "stopSequence" : 5
      },
      "routeSpan" : {
        "early" : {
          "source_table" : "frequencies",
          "route_id" : "1713",
          "feed_name" : "anaheim-ca-us",
          "departure_time" : "2015-10-23T17:00:00Z"
        },
        "late" : {
          "source_table" : "stop_times",
          "route_id" : "1713",
          "feed_name" : "anaheim-ca-us",
          "departure_time" : "2015-10-24T05:30:00Z"
        }
      }
    }, {
      "rentedBike" : false,
      "departureDelay" : 0,
      "agencyTimeZoneOffset" : -25200000,
      "startTime" : 1445656801000,
      "endTime" : 1445658565000,
      "steps" : [ {
        "streetName" : "service road",
        "elevation" : [ ],
        "relativeDirection" : "DEPART",
        "absoluteDirection" : "SOUTHEAST",
        "bogusName" : true,
        "lon" : -117.87121581965805,
        "lat" : 33.77466979795216,
        "stayOn" : false,
        "area" : false,
        "distance" : 388.331
      }, {
        "streetName" : "North Main Street",
        "elevation" : [ ],
        "relativeDirection" : "RIGHT",
        "absoluteDirection" : "SOUTH",
        "bogusName" : false,
        "lon" : -117.86741230000001,
        "lat" : 33.7737568,
        "stayOn" : false,
        "area" : false,
        "distance" : 105.541
      }, {
        "streetName" : "Memory Lane",
        "elevation" : [ ],
        "relativeDirection" : "LEFT",
        "absoluteDirection" : "EAST",
        "bogusName" : false,
        "lon" : -117.86734580000001,
        "lat" : 33.7728151,
        "stayOn" : false,
        "area" : false,
        "distance" : 18.891
      } ],
      "mode" : "WALK",
      "duration" : 1764.0,
      "route" : "",
      "interlineWithPreviousLeg" : false,
      "legGeometry" : {
        "points" : "srcmEbvlnUJIRWT[N_@He@DUFOT[RWRYRYBk@@g@?iC?k@?{EvCAb@KJe@",
        "length" : 20
      },
      "realTime" : false,
      "pathway" : false,
      "from" : {
        "departure" : 1445656801000,
        "arrival" : 1445656800000,
        "stopCode" : null,
        "name" : "Main St. & Mainplace Mall",
        "vertexType" : "TRANSIT",
        "stopId" : "248:780771",
        "lon" : -117.87105,
        "lat" : 33.77476,
        "stopIndex" : 4,
        "stopSequence" : 5
      },
      "distance" : 512.763,
      "transitLeg" : false,
      "arrivalDelay" : 0,
      "to" : {
        "name" : "Memory Lane",
        "lon" : -117.86715233781749,
        "lat" : 33.772752637963684,
        "arrival" : 1445658565000,
        "orig" : "",
        "vertexType" : "NORMAL"
      }
    } ],
    "transfers" : 0,
    "transitTime" : 1020,
    "elevationLost" : 0.0
  }, {
    "waitingTime" : 2,
    "startTime" : 1445647765000,
    "endTime" : 1445651365000,
    "fare" : {
      "fare" : {
        "regular" : {
          "currency" : {
            "currency" : "USD",
            "defaultFractionDigits" : 2,
            "currencyCode" : "USD",
            "symbol" : "$"
          },
          "cents" : 300
        }
      }
    },
    "elevationGained" : 0.0,
    "duration" : 3600,
    "walkLimitExceeded" : false,
    "tooSloped" : false,
    "walkTime" : 2518,
    "walkDistance" : 728.187333303796,
    "legs" : [ {
      "rentedBike" : false,
      "departureDelay" : 0,
      "agencyTimeZoneOffset" : -25200000,
      "startTime" : 1445647765000,
      "endTime" : 1445648519000,
      "steps" : [ {
        "streetName" : "South Harbor Boulevard",
        "elevation" : [ ],
        "relativeDirection" : "DEPART",
        "absoluteDirection" : "SOUTH",
        "bogusName" : false,
        "lon" : -117.91541338573779,
        "lat" : 33.80464805427682,
        "stayOn" : false,
        "area" : false,
        "distance" : 173.92
      }, {
        "streetName" : "path",
        "elevation" : [ ],
        "relativeDirection" : "RIGHT",
        "absoluteDirection" : "WEST",
        "bogusName" : true,
        "lon" : -117.9153869,
        "lat" : 33.8030842,
        "stayOn" : false,
        "area" : false,
        "distance" : 40.760999999999996
      } ],
      "mode" : "WALK",
      "duration" : 754.0,
      "route" : "",
      "interlineWithPreviousLeg" : false,
      "legGeometry" : {
        "points" : "_nimEjjunUdA?|@?l@Aj@?ZA^?\\A?ZDCj@?",
        "length" : 11
      },
      "realTime" : false,
      "pathway" : false,
      "from" : {
        "name" : "South Harbor Boulevard",
        "lon" : -117.91541338573779,
        "lat" : 33.80464805427682,
        "departure" : 1445647765000,
        "orig" : "",
        "vertexType" : "NORMAL"
      },
      "distance" : 214.68099999999998,
      "transitLeg" : false,
      "arrivalDelay" : 0,
      "to" : {
        "departure" : 1445648520000,
        "arrival" : 1445648519000,
        "stopCode" : null,
        "name" : "Portofino Stop",
        "vertexType" : "TRANSIT",
        "stopId" : "248:778154",
        "lon" : -117.91547,
        "lat" : 33.80284,
        "stopIndex" : 1,
        "stopSequence" : 2
      }
    }, {
      "rentedBike" : false,
      "departureDelay" : 0,
      "agencyTimeZoneOffset" : -25200000,
      "startTime" : 1445648520000,
      "routeLongName" : "Santa Ana Line",
      "endTime" : 1445649600000,
      "steps" : [ ],
      "mode" : "BUS",
      "duration" : 1080.0,
      "route" : "19",
      "interlineWithPreviousLeg" : false,
      "legGeometry" : {
        "points" : "wbimEbjunU??dRM?lJQJAZNPTCNV@v@?nCHJR@F_AKoCGYYSEsKfUS?kV?u^uJHmOBqO@@gM`C@n@Od@a@\\sAJ{G^oArDuDl@|@PQFu@\\a@??FKYi@~FmGHUdR_SAkL?mUBwMCcL?}OHaAn@{EFoB?qK?mP@kOb@cEb@eB|@uBZiCBsNMoAYqBEy@Fi@vP?~OB|@Ph@h@b@d@f@^nAPtBB|MEhIDtLD|N@pG@pKBrOAIvGAtEAnAIn@Qh@q@l@}DtBcAuAd@u@EC[@OBW\\",
        "length" : 90
      },
      "agencyName" : "Anaheim Resort Transportation",
      "realTime" : false,
      "routeColor" : "2C0093",
      "serviceDate" : "20151023",
      "agencyUrl" : "http://www.rideart.org/",
      "routeUrl" : "http://rideart.org/routes-and-schedules/mainplace-line/",
      "pathway" : false,
      "routeHumanFrequency" : "See schedule",
      "headsign" : "Disneyland Resort",
      "from" : {
        "departure" : 1445648520000,
        "arrival" : 1445648519000,
        "stopCode" : null,
        "name" : "Portofino Stop",
        "vertexType" : "TRANSIT",
        "stopId" : "248:778154",
        "lon" : -117.91547,
        "lat" : 33.80284,
        "stopIndex" : 1,
        "stopSequence" : 2
      },
      "tripId" : "107507A1639B2933",
      "agencyId" : "248",
      "routeId" : "1713",
      "distance" : 5950.749039460567,
      "transitLeg" : true,
      "arrivalDelay" : 0,
      "routeTextColor" : "FFFFFF",
      "routeType" : 3,
      "routeShortName" : "19",
      "to" : {
        "departure" : 1445649601000,
        "arrival" : 1445649600000,
        "stopCode" : null,
        "name" : "Main St. & Mainplace Mall",
        "vertexType" : "TRANSIT",
        "stopId" : "248:780771",
        "lon" : -117.87105,
        "lat" : 33.77476,
        "stopIndex" : 4,
        "stopSequence" : 5
      },
      "routeSpan" : {
        "early" : {
          "source_table" : "frequencies",
          "route_id" : "1713",
          "feed_name" : "anaheim-ca-us",
          "departure_time" : "2015-10-23T17:00:00Z"
        },
        "late" : {
          "source_table" : "stop_times",
          "route_id" : "1713",
          "feed_name" : "anaheim-ca-us",
          "departure_time" : "2015-10-24T05:30:00Z"
        }
      }
    }, {
      "rentedBike" : false,
      "departureDelay" : 0,
      "agencyTimeZoneOffset" : -25200000,
      "startTime" : 1445649601000,
      "endTime" : 1445651365000,
      "steps" : [ {
        "streetName" : "service road",
        "elevation" : [ ],
        "relativeDirection" : "DEPART",
        "absoluteDirection" : "SOUTHEAST",
        "bogusName" : true,
        "lon" : -117.87121581965805,
        "lat" : 33.77466979795216,
        "stayOn" : false,
        "area" : false,
        "distance" : 388.331
      }, {
        "streetName" : "North Main Street",
        "elevation" : [ ],
        "relativeDirection" : "RIGHT",
        "absoluteDirection" : "SOUTH",
        "bogusName" : false,
        "lon" : -117.86741230000001,
        "lat" : 33.7737568,
        "stayOn" : false,
        "area" : false,
        "distance" : 105.541
      }, {
        "streetName" : "Memory Lane",
        "elevation" : [ ],
        "relativeDirection" : "LEFT",
        "absoluteDirection" : "EAST",
        "bogusName" : false,
        "lon" : -117.86734580000001,
        "lat" : 33.7728151,
        "stayOn" : false,
        "area" : false,
        "distance" : 18.891
      } ],
      "mode" : "WALK",
      "duration" : 1764.0,
      "route" : "",
      "interlineWithPreviousLeg" : false,
      "legGeometry" : {
        "points" : "srcmEbvlnUJIRWT[N_@He@DUFOT[RWRYRYBk@@g@?iC?k@?{EvCAb@KJe@",
        "length" : 20
      },
      "realTime" : false,
      "pathway" : false,
      "from" : {
        "departure" : 1445649601000,
        "arrival" : 1445649600000,
        "stopCode" : null,
        "name" : "Main St. & Mainplace Mall",
        "vertexType" : "TRANSIT",
        "stopId" : "248:780771",
        "lon" : -117.87105,
        "lat" : 33.77476,
        "stopIndex" : 4,
        "stopSequence" : 5
      },
      "distance" : 512.763,
      "transitLeg" : false,
      "arrivalDelay" : 0,
      "to" : {
        "name" : "Memory Lane",
        "lon" : -117.86715233781749,
        "lat" : 33.772752637963684,
        "arrival" : 1445651365000,
        "orig" : "",
        "vertexType" : "NORMAL"
      }
    } ],
    "transfers" : 0,
    "transitTime" : 1080,
    "elevationLost" : 0.0
  } ]
}
@ed-g
Copy link
Owner

ed-g commented Oct 21, 2015

Hello Aaron,

stop_code was being included previously. I had to do an emergency patch of the proxy to make it compatible with the changes in JSON format between OTP 0.11 and OTP 0.18, essentially translating 0.18 responses into the 0.11 format.

Let me check and see if stop_code is still being included in the results.

Those stop_codes are definitely in the GTFS.

Ed

@ed-g
Copy link
Owner

ed-g commented Oct 22, 2015

Aaron,

I've fixed the stop_codes.

Old version of OTP didn't include stop codes so the proxy had to look them up via GTFS-API.

New version of OTP changed how they return the stopId from {"agencyId" : "248", "id", "778277" } to "248:778277" , which broke the GTFS-API lookup. Fortunately, they now include stop_codes in the results, so I could simply disable the GTFS-API lookup function.

Here is a test url which uses a recent day, above testing URL is from March where the data is no longer available.

http://gtfs-api.groth-geodata.com/trip-planner/anaheim-ca-us/plan?fromPlace=33.8046480634388,-117.915358543396&toPlace=33.77272636987434,-117.8671646118164&time=1:29pm&date=10-15-2015

@ed-g
Copy link
Owner

ed-g commented Oct 22, 2015

Note there are some stops which do not have codes, I don't know if this is a problem or not.

stop_id stop_code              stop_name              
─────── ───────── ───────────────────────────────────
783912            Discovery Cube Science Center
783914            Bowers Museum
787483            4th & Spurgeon Santa Ana
787484            2nd & Broadway Santa Ana
787488            Ramada Inn & Suites
787489            Holiday Inn Express
787490            BLVD Hotel
787491            Best Western Plus Newport Mesa Inn
787492            Ayres Inn Costa Mesa
787493            Residence Inn by Marriott
787494            Hilton Costa Mesa
787495            Costa Mesa Marriott
787496            Avenue of the Arts Wyndham Hotel
787497            The Westin South Coast Plaza
787498            South Coast Plaza (MACY's  Valet)
787499            Residence Inn Garden Grove (Harbor)
787500            Red Robin
794902            Disneyland (Harbor Blvd.)

@antrim
Copy link
Collaborator Author

antrim commented Oct 22, 2015

Thanks, Ed!

Yes, we have suggested Anaheim should assign stop_codes to some these. Not
sure exactly what the status is.

On Wed, Oct 21, 2015 at 5:33 PM, Ed Groth [email protected] wrote:

Note there are some stops which do not have codes, I don't know if this is
a problem or not.

stop_id stop_code stop_name
─────── ───────── ───────────────────────────────────
783912 Discovery Cube Science Center
783914 Bowers Museum
787483 4th & Spurgeon Santa Ana
787484 2nd & Broadway Santa Ana
787488 Ramada Inn & Suites
787489 Holiday Inn Express
787490 BLVD Hotel
787491 Best Western Plus Newport Mesa Inn
787492 Ayres Inn Costa Mesa
787493 Residence Inn by Marriott
787494 Hilton Costa Mesa
787495 Costa Mesa Marriott
787496 Avenue of the Arts Wyndham Hotel
787497 The Westin South Coast Plaza
787498 South Coast Plaza (MACY's Valet)
787499 Residence Inn Garden Grove (Harbor)
787500 Red Robin
794902 Disneyland (Harbor Blvd.)


Reply to this email directly or view it on GitHub
#2 (comment).

Aaron Antrim, Principal
Trillium Solutions, Inc.
www.trilliumtransit.com
Portland, Oregon
503.567.8422 ext. 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants