| | |
| | | <?php |
| | | require_once 'vendor/autoload.php'; |
| | | require('vendor/autoload.php'); |
| | | require('common.php'); |
| | | |
| | | use transit_realtime\FeedMessage; |
| | | |
| | |
| | | $trip = $vehiclePosition->getTrip(); |
| | | $tripId = $trip->getTripId(); |
| | | $this->gtfsTrips[self::convertTripId($tripId)] = [ |
| | | 'id' => $entity->getId(), |
| | | 'num' => $vehicle->getLicensePlate(), |
| | | 'tripId' => $tripId, |
| | | 'latitude' => $position->getLatitude(), |
| | |
| | | } |
| | | |
| | | if($options != 1) { |
| | | fwrite(STDERR, 'Found '.$options.' possible mappings!'."\n"); |
| | | return FALSE; |
| | | } |
| | | return $bestOffset; |
| | |
| | | foreach($this->gtfsTrips as $gtfsTripId => $gtfsTrip) { |
| | | $jsonTripId = $gtfsTripId + $offset; |
| | | if(isset($this->jsonTrips[$jsonTripId])) { |
| | | $result[$jsonTripId] = [ |
| | | 'num' => $gtfsTrip['num'], |
| | | ]; |
| | | $data = numToTypeB($gtfsTrip['id']); |
| | | $num = $gtfsTrip['num']; |
| | | if($data['num'] != $num) { |
| | | fwrite(STDERR, 'Got '.$num.', database has '.$data['num']."\n"); |
| | | } |
| | | $result[$jsonTripId] = $data; |
| | | } |
| | | } |
| | | return $result; |