Skip to contents

This vignette highlights some known limitations or bugs with OpenTripPlanner as well as suggested solutions.

Getting help and reporting bugs

OpenTripPlanner for R

Reasons for Graph building to Fail

The otp_build_graph() function returns the log from OTP, so the reasons for failures should be documented in the log. Common problems include.

Can’t allocate memory

If you get the error:

Invalid maximum heap size: The specified size exceeds the maximum representable size.

Then the memory argument in otp_build_graph() is too large. This may be because you have set it to more than the amount of RAM on your computer or because you have the 32 bit version of Java rather than the 64 Bit version installed.

Ran out of memory

A graph build can fail due to lack of memory. You can increase the memory allocated using the memory argument in otp_build_graph().

Bad input data

If you have multiple input files (e.g. GTFS timetables, elevation, config files) and your graph build is failing, try removing all but the PBF file and seeing if the graph can now successfully build. If it does, add files one at a time until you find the file that is causing the build to fail.

Reasons for Routing to Fail

If you find OTP can not find a route here are some common reasons to check:

Start or End is too far from the road network

OTP will snap fromPlace and toPlace coordinates to the road network, but only for a limited distance. If your points are far from the road network (e.g. in a lake or middle of a park) then OTP will fail to find a route.

Mode Specific Limits

OTP does not support all mode combinations (e.g. walk + drive) so some places may only be accessible by certain modes. For example, you can’t walk on a motorway or drive on a path. Use the debug layers to check for mode restrictions.

Maximum walk to transit

By default, OTP caps the maximum walking distance to a transit stop at a low level, so some areas are unreachable by transit. Increase the maximum walking distance to get better results.

Driving on Roads with cycleway tag

A known bug that stops driving on any road with cycling infrastructure. https://groups.google.com/forum/#!topic/opentripplanner-users/BOv1J32k6Sc

Multicore instability

If you get the error:

Error in unserialize(socklist[[n]]) : error reading from connection

It means that one of the parallel workers has crashed. Try running your routing in smaller batches like this:

This code will break the routing into 5 batches and put the results into a list called routes_list before binding them together into the finished routes data frame.

routes_list <- list()
n <- split(1:nrow(fromPlace), cut(1:nrow(fromPlace), 5))

for(i in 1:5){
  vals <- n[[i]]
  routes_sub <- otp_plan(otpcon,
                        fromPlace = fromPlace[vals,],
                        toPlace = toPlace[vals,])
  routes_list[[i]] <- routes_sub
}

routes <- dplyr::bind_rows(routes_list)

Speeding up routing

If you are doing a large amount of routing consider the following options.

  1. Use multicore routing using ncores argument of otp_plan()
  2. Reduce the area, for example, if you are only routing in one city you don’t need a whole country graph.
  3. Remove unneeded roads using osmfilter or OSMtools for example if you are only interested in driving you can remove footpaths and cycleways. This will simplify your graph and provide a small performance boost.
  4. Upgrading your computer, a new fast CPU with more cores will route faster.

GTFS Data for the UK

See https://github.com/ITSLeeds/UK2GTFS

Elevation Data

It is common for GeoTIFF to have a no data value often the maximum possible value. OTP can misinterpret this as an elevation value. So set your no data values in your elevation data to something more plausible like 0.

Note that OTP does not support all types of GeoTIFF compression so you may have to change the compression type of the image if you are experiencing problems.