This vignette highlights some known limitations or bugs with OpenTripPlanner as well as suggested solutions.
The otp_build_graph()
function returns the log from OTP, so the reasons for failures should be documented in the log. Common problems include.
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.
A graph build can fail due to lack of memory. You can increase the memory allocated using the memory
argument in otp_build_graph()
.
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.
If you find OTP can not find a route here are some common reasons to check:
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.
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.
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.
A known bug that stops driving on any road with cycling infrastructure. https://groups.google.com/forum/#!topic/opentripplanner-users/BOv1J32k6Sc
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)
If you are doing a large amount of routing consider the following options.
ncores
argument of otp_plan()
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.