MobilityDB 1.3
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
ais_expand_full.c File Reference

A simple program that reads AIS data from a CSV file containing one full day of observations provided by the Danish Maritime Authority in https://web.ais.dk/aisdata/, constructs for each ship temporal values for the trip and the SOG, and outputs for each ship the MMSI, the number of records and instants used for contruct the temporal values, the distance travelled and the time-weighted average of the SOG. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <meos.h>
#include <meos_geo.h>
#include <meos_internal.h>

Data Structures

struct  AIS_record
 
struct  trip_record
 

Macros

#define INITIAL_INSTANTS   64
 
#define MAX_LENGTH_LINE   1024
 
#define MAX_LENGTH_POINT   64
 
#define MAX_LENGTH_STRING   64
 
#define MAX_LENGTH_TIMESTAMP   32
 
#define MAX_NO_RECORDS   20000000
 
#define MAX_SHIPS   6500
 
#define NO_RECORDS_BATCH   100000
 

Functions

int main (void)
 

Detailed Description

A simple program that reads AIS data from a CSV file containing one full day of observations provided by the Danish Maritime Authority in https://web.ais.dk/aisdata/, constructs for each ship temporal values for the trip and the SOG, and outputs for each ship the MMSI, the number of records and instants used for contruct the temporal values, the distance travelled and the time-weighted average of the SOG.

Please notice that the data directory DOES NOT contain the input CSV file, you must download it from the website above.

Please read the assumptions made about the input CSV file in the file 02_ais_read.c in the same directory. The program assumes that the input file contains at most a given number of records for at most a given number of ships, as defined by two compilation constraints. Also, the program copes with minimal error correction, that is,

The program can be build as follows

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