Apparently a newer version has been deployed: 
https://groups.google.com/d/msg/transit-developers/MbGRNM9keJ8/577Le0zwrGQJ 


Am Montag, 14. April 2014 19:03:01 UTC-4 schrieb Daniel:
>
> Hi,
>
> I am currently trying to decode a vehiclePositions.pb file and saving it 
> into a postgres database table. It worked so far until last week. The table 
> has following columns:
>
>
>
>
>
>
>
>
>
>
>
> *CREATE TABLE vehicle_positions(  trip_id integer,  lat real,  lon real,  
> curr_stop_seq smallint,  curr_status text,  stop_id integer,  timestmp 
> timestamp with time zone)*
> The java-code looks as follows:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *private static List<VehiclePosition> onMessage(byte[] message, Date 
> date)    {        FeedMessage feedMessage = null;        List<FeedEntity> 
> feedEntityList = null;        List<VehiclePosition> pos = null;        
> try        {            // Decode message into List of VehiclePositions    
>         feedMessage = FeedMessage.PARSER.parseFrom(message);            
> feedEntityList = feedMessage.getEntityList();            pos = new 
> ArrayList<VehiclePosition>(feedEntityList.size());            
> DatabaseConnection.openDatabaseConnection();            
> System.out.println("Start INSERT into DB: " + new Timestamp(new 
> Date().getTime()));            for (FeedEntity feedEntity : 
> feedEntityList)            {                if 
> (feedEntity.hasVehicle()){                    
> pos.add(feedEntity.getVehicle());                    
> System.out.println(feedEntity.getVehicle().getTrip() + ", " + 
> feedEntity.getVehicle().getPosition()+"\n");       // INFORMATION ABOUT 
> POSITION AVAILABLE, BUT NO TRIP INFORMATION                    
> //DatabaseConnection.saveVehiclePositionIntoDB(feedEntity.getVehicle(), 
> date);                }                                                }    
>     } catch (InvalidProtocolBufferException e)        {            
> System.out.println("Could not decode gtfs-rt message: " + e);        }    
>     DatabaseConnection.closeDatabaseConnection();        if (pos != null && 
> pos.size() > 0)        {            // do something        }        
> System.out.println("Finished INSERT into DB: " + new Timestamp(new 
> Date().getTime()));        return pos;    }*
>
> The byte[] message is gathered by the following method:
>
>
>
>
>
>
>
>
> *private static byte[] convertToByteArray(File file) throws Exception, 
> IOException, UnsupportedEncodingException    {        FileInputStream 
> fileInputStream = new FileInputStream(file);        byte[] data = new 
> byte[(int) file.length()];        fileInputStream.read(data);        
> fileInputStream.close();        return data;    }*
>
>
> Until last week, all information about position, stop_ID, 
> current_stop_sequence and the trip_ID was available, when I'm executing the 
> code now, the feedEntity contains all information but the trip_ID. I 
> checked all classes, created the proto.java using protoc again, also tried 
> to debug it, but there is no information about the trip_ID and I don't know 
> why. The vehiclePositions.pb file will be gathered from 
> http://gtfs.ovapi.nl/new/. Can anybody give tips to locate the problem?
>
> Thanks,
> Daniel
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to