rafapereirabr / otp-travel-time-matrix

Tutorial with reproducible example to estimate a travel time matrix using OpenTripPlanner and Python
51 stars 24 forks source link

Make the demo work by adjusting script and points. #1

Closed laurentg closed 8 years ago

rafapereirabr commented 8 years ago

Hi Laurent,

as you will remember, you helped me organize a python script to query a travel time matrix using OTP. I'm now facing two questions that I'm sure you've faced before:

  1. How can I set a limit to the number of connections?
  2. How can I add to the csv output the travel cost based on transit fare ?

Here is the snippet of the python script where I believe I should add another column. I haven't found a manual for these code conventions used in OTP, but I assume it would be something like r.getFare().

  # Add a new row of result in the CSV output
  for r in result:
    matrixCsv.addRow([ origin.getStringData('GEOID'), r.getIndividual().getStringData('GEOID'), r.getWalkDistance() , r.getTime(), r.getFare() ])