src/main/java/com/conveyal/gtfs/GTFSFeed.java
public double getTripSpeed (String trip_id, boolean straightLine) {

        StopTime firstStopTime = this.stop_times.ceilingEntry(Fun.t2(trip_id, null)).getValue();
        StopTime lastStopTime = this.stop_times.floorEntry(Fun.t2(trip_id, Fun.HI)).getValue();

        // ensure that stopTime returned matches trip id (i.e., that the trip has stoptimes)
        if (!firstStopTime.trip_id.equals(trip_id) || !lastStopTime.trip_id.equals(trip_id)) {
            return Double.NaN;
        }

        double distance = getTripDistance(trip_id, straightLine);

        // trip time (in seconds)
        int time = lastStopTime.arrival_time - firstStopTime.departure_time;

        return distance / time; // meters per second
    }
public double getTripSpeed (String trip_id, boolean straightLine) {

        StopTime firstStopTime = this.stop_times.ceilingEntry(Fun.t2(trip_id, null)).getValue();
        StopTime lastStopTime = this.stop_times.floorEntry(Fun.t2(trip_id, Fun.HI)).getValue();

        // ensure that stopTime returned matches trip id (i.e., that the trip has stoptimes)
        if (!firstStopTime.trip_id.equals(trip_id) || !lastStopTime.trip_id.equals(trip_id)) {
            return Double.NaN;
        }

        double distance = getTripDistance(trip_id, straightLine);

        // trip time (in seconds)
        int time = lastStopTime.arrival_time - firstStopTime.departure_time;

        return distance / time; // meters per second
    }
public double getTripSpeed ( String trip_id , boolean straightLine ) { StopTime firstStopTime = this . stop_times . ceilingEntry ( Fun . t2 ( trip_id , null ) ) . getValue ( ) ; StopTime lastStopTime = this . stop_times . floorEntry ( Fun . t2 ( trip_id , Fun . HI ) ) . getValue ( ) ; // ensure that stopTime returned matches trip id (i.e., that the trip has stoptimes) if ( ! firstStopTime . trip_id . equals ( trip_id ) || ! lastStopTime . trip_id . equals ( trip_id ) ) { return Double . NaN ; } double distance = getTripDistance ( trip_id , straightLine ) ; // trip time (in seconds) int time = lastStopTime . arrival_time - firstStopTime . departure_time ; return distance / time ; // meters per second }
Get trip speed in meters per second.
Get trip speed in meters per second .