Command line in Python for isochrones in TRANSIT?

333 views
Skip to first unread message

Alain L'Hostis

unread,
Feb 10, 2017, 9:10:22 AM2/10/17
to OpenTripPlanner Users
Hello all
I have an OTP server running with a graph with GTFS ans OSM files, and I am able to generate routes through transit and other options from Firefox.
I have a python scrip for generating isochrones, copied below.
This python script works for WALK, BIKE and CAR modes but fails when I set TRANSIT or simply BUS
What should I type to get the TRANSIT and Walk and other combinations?
thanks



import json, requests

#orig= (48.87042, 2.39785)

orig= (50.67673, 3.11186)


depTime = "08:00:00"

cutoff = 600 #in seconds 600 s = 10 min

#modes = "BICYCLE"

#modes = "WALK"

modes = "BUS"

#modes = "TRANSIT,WALK"


baseURL = 'http://localhost:8080/otp/routers/default/isochrone?'

qryDT = '&date=2015/12/7&time={0}&mode={1}&cutoffSec={2}'.format(depTime, modes, cutoff)

url = '{0}fromPlace={1}&{2}'.format(baseURL, orig, qryDT)


response = requests.get(url)

data = json.loads(response.text)


with open('iso_bus_10min.geojson', 'w') as outfile:

json.dump(data, outfile)

Laurent Grégoire

unread,
Feb 10, 2017, 9:17:31 AM2/10/17
to OpenTripPlanner Users
Hello,

Le vendredi 10 février 2017 15:10:22 UTC+1, Alain L'Hostis a écrit :
This python script works for WALK, BIKE and CAR modes but fails when I set TRANSIT or simply BUS

Fails how, do you get an error message on the server, or the script? You can try the URL you generate on your script first to see if you get something.

HTH,

--Laurent

Alain L'Hostis

unread,
Feb 10, 2017, 9:40:52 AM2/10/17
to OpenTripPlanner Users
In Spyder I get "No JSON object could be decoded"
the url is:http://localhost:8080/otp/routers/default/isochrone?fromPlace=(50.67673,%203.11186)&&date=2015/12/7&time=08:00:00&mode=BUS&cutoffSec=600
and I read in the browser:
org.opentripplanner.routing.error.TransitTimesException null

Laurent Grégoire

unread,
Feb 10, 2017, 9:45:47 AM2/10/17
to OpenTripPlanner Users
You can maybe try with "mode=BUS,WALK"
HTH,

--Laurent 

Alain L'Hostis

unread,
Feb 10, 2017, 9:47:52 AM2/10/17
to OpenTripPlanner Users
I got the exact same error message with BUS,WALK

Andrew Byrd

unread,
Feb 10, 2017, 10:35:58 AM2/10/17
to Alain L'Hostis, OpenTripPlanner Users
Hi Alain,

> On 10 Feb 2017, at 22:40, Alain L'Hostis <lhos...@gmail.com> wrote:
> I read in the browser:
> org.opentripplanner.routing.error.TransitTimesException null
Here’s the comment text from that exception:

“Indicates that a transit mode was specified, but the search date provided was outside the date range of the transit data feed used to construct the graph. In other words, there is no transit service information available, and the user needs to be told this.”

So, OTP thinks there is no transit service specified on the date of your query. If you’re sure your GTFS feed has active transit service on that date, look through the log messages from the graph build process to make sure some error in the GTFS feed did not cause OTP to completely fail to load the transit data. There could also be a problem with the service calendars etc. in the GTFS feed.

As for your other error (empty screen in Firefox or Chromium with --inMemory --analyst switches) , I still need to look into it. I’ll let you know via the mailing list if I can reproduce the problem.

Regards,
Andrew

Alain L'Hostis

unread,
Feb 10, 2017, 10:46:20 AM2/10/17
to OpenTripPlanner Users, lhos...@gmail.com
Dear Andrew,
thanks for your help
for testing purpose here is a link to the data I used: https://filesender-beta.renater.fr/?s=download&token=9b284240-43f4-8248-042d-0f3e1df75c03
The url is this one:

http://localhost:8080/otp/routers/default/isochrone?fromPlace=(50.67673, 3.11186)&&date=2015/12/7&time=08:00:00&mode=BUS,WALK&cutoffSec=600

no date in it, How could I specify the date?

This error is troubling because on the web interface I am able to draw itineraries.

Alain

Laurent Grégoire

unread,
Feb 13, 2017, 9:10:05 AM2/13/17
to OpenTripPlanner Users, lhos...@gmail.com
Hi Alain,


Le vendredi 10 février 2017 16:46:20 UTC+1, Alain L'Hostis a écrit :

http://localhost:8080/otp/routers/default/isochrone?fromPlace=(50.67673, 3.11186)&&date=2015/12/7&time=08:00:00&mode=BUS,WALK&cutoffSec=600

no date in it, How could I specify the date?


Unless I'm mistaken, but you do specify a date in the URL, which is rather far into the past (7 Dec 2015). Are you sure we talk about the same URL?

HTH,

--Laurent

Alain L'Hostis

unread,
Feb 13, 2017, 9:17:48 AM2/13/17
to OpenTripPlanner Users, lhos...@gmail.com
Thank you Laurent!! this is the source of my problem, I did not carefully read the URL, the date is here, and changing it made it work!
Reply all
Reply to author
Forward
0 new messages