ed-g / otp-api-proxy

OpenTripPlanner API proxy
Eclipse Public License 1.0
0 stars 0 forks source link

stop_code is not returned #2

Open antrim opened 9 years ago

antrim commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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 notifications@github.com 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 https://github.com/ed-g/otp-api-proxy/issues/2#issuecomment-150063300.

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