Create .ov2 files to add POI data to a TomTom GPS device (php)

An OV2 file consists of POI records. Each record has the following data format.

1 BYTE, char, POI status (’0′ or ’2′)
4 BYTES, long, denotes length of the POI record.
4 BYTES, long, longitude * 100000
4 BYTES, long, latitude * 100000
x BYTES, string, label for POI, x =3D=3D total length =96 (1 + 3 * 4)
Terminating null byte.


$csv = file("File.csv"); 
$nbcsv = count($csv); 
$file = "POI.ov2"; 
$fp = fopen($file, "w"); 
for ($i = 0; $i < $nbcsv; $i++) { 
    $table = split(",", chop($csv[$i])); 
    $lon = $table[0]; 
    $lat = $table[1]; 
    $des = $table[2]; 
    $TT = chr(0x02).pack("V",strlen($des)+14).pack("V",round($lon*100000)).pack("V",round($lat*100000)).$des.chr(0x00); 
    @fwrite($fp, "$TT"); 
Posted in PHP, TomTom

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: