MobilityDB 1.1

◆ MAX_LENGTH_TRIP

#define MAX_LENGTH_TRIP   170001

A simple program that reads from a CSV file synthetic trip data in Brussels generated by the MobilityDB-BerlinMOD generator, https://github.com/MobilityDB/MobilityDB-BerlinMOD disassembles the trips into individual observations, and write them in a CSV file named "trip_instants.csv" ordered by timestamp.

The input file is

  • trips.csv: 55 trips from 5 cars during 4 days obtained from the generator at scale factor 0.005. The input file has been generated with the following SQL command on the database containing the generated data
    COPY (SELECT tripid, vehid, day, seqno, ashexewkb(trip) AS trip FROM trips WHERE vehid < 6 ORDER BY tripid) TO '/home/user/src/trips.csv' CSV HEADER;
    CREATE TABLE trips(tripid int NOT NULL, vehid int NOT NULL, day date NOT NULL, seqno int NOT NULL, trip tgeompoint NOT NULL)
    COPY(SELECT tripid, vehid, day, seqno, asHexEWKB(trip) AS trip FROM trips) TO '/home/esteban/src/MobilityDB/meos/examples/trips.csv' CSV HEADER
    INSERT INTO trips SELECT day
    Definition: meos_disassemble_berlinmod.txt:22
    INSERT INTO trips SELECT seqno
    Definition: meos_disassemble_berlinmod.txt:22
    INSERT INTO trips SELECT tripid
    Definition: meos_disassemble_berlinmod.txt:22
    INSERT INTO trips SELECT vehid
    Definition: meos_disassemble_berlinmod.txt:22
    COPY trip_instants FROM home esteban src MobilityDB meos examples trip_instants csv CSV HEADER
    Definition: meos_disassemble_berlinmod.txt:11
    In the above file, the coordinates are given in the 3857 coordinate system, https://epsg.io/3857 and the timestamps are given in the Europe/Brussels time zone. This simple program does not cope with erroneous inputs, such as missing fields or invalid values.

The program can be build as follows

gcc -Wall -g -I/usr/local/include -o 05_meos_disassemble_berlinmod 05_meos_disassemble_berlinmod.c -L/usr/local/lib -lmeos