NAME

Geo::Ov2 - Library for reading and writing TomTom Navigator .ov2 POI files.

Extends IO::File

VERSION

Version 0.91

SYNOPSIS

Because this is a child of IO::File, all functions of IO::File are accessibe. No overriding is done.

The core of this module is done by two main methods poiread and poiwrite.

There are also another supporting functions, such as area_envelope, deareizator, split_area which works with ov2 record 0x01 - area and makes TTN working faster.

The third sort of methods are getters/setters, which controls behavior of the module. These are deareize, repartition and repart_size.

And at the end thera are poireadall and poiwriteall, which reads and writes array of pois. Poiwriteall do also rearealization, if repartition flag is set and stripes original 0x01 records if deareize flag is set.

Perhaps a little code snippet.

    use Geo::Ov2;

    my $ov2 = Geo::Ov2->new( "<filename" );
    
    while ( my $poi = $ov2->poiread() ) {
	printf "type: %d; longitude: %f; latitude: %f; description: %s\n", ${$poi}{type}, ${$poi}{longitude}, ${$poi}{latitude}, ${$poi}{description};
    }

    my @pois = @{$ov2->poireadall()};
    foreach $poi (@pois) {
	printf "type: %d; longitude: %f; latitude: %f; description: %s\n", ${$poi}{type}, ${$poi}{longitude}, ${$poi}{latitude}, ${$poi}{description};
    }

    $ov2->poiwrite( { type => 2, longitude => 4000000, latitude => 1200000, descrption => "my POI" } );
    $ov2->poiwriteall( @pois );

    @pois = @{$self->deareizator( @pois )};
    @pois = @{$self->split_area( 0, @pois )};

EXPORT

A list of functions that can be exported. You can delete this section if you don't export anything, such as for a purely object-oriented module.

FUNCTIONS

_params

This is an internal function, which allows set and get parameters for each instance. This is required because of parrent IO::File uses fle descriptor as $self, so it can not be used for storing other data.

deareize

This is a getter and setter of deareize flag for specific instance of object.

repartition

This is a getter and setter of repartition flag for specific instance of object.

repart_size

This is a getter and setter of repart_size value for specific instance of object.

_param

This is an internal function, which allows set and get parameters for each instance. This is required because of parrent IO::File uses fle descriptor as $self, so it can not be used for storing other data.

poiwrite

This method writes data referenced by hashref into ov2 file. if "data" atribute is provided, it is written into a file, otherwise method pack data supplied in other attributes, fills "data" attribude and then it is written.

input

inpus is a hashref, which has following structure:

{
    type => 2,
    longitude => 5000000,
    latitude => 1100000,
    description => "some text",
    data => "packed above data into binary form of ov2"
}

poiread

This method reads data from ov2 file and returns hashref into POI structure:

{
    type => 2,
    longitude => 5000000,
    latitude => 1100000,
    description => "some text",
    data => "packed above data into binary form of ov2"
}

poiwriteall

Method gets array of hashrefs into POIs and writes it into ov2 file. When deareize is set, it also strips all 0x01 records (area) befor writting. When repartition is set, it does deareize and then it creates own area structure for POIs in array. Then all it is written to ov2 file.

poireadall

This method reads the whole ov2 file and returns array of hashrefs into POI structures.

area_envelope

This method expects array of hashrefs into POIs and returns structure of 0x01 record, which is area for these POIs.

deareizator

This method expects array of POI hashrefs on input and rturns reference to array which is copy of source array, but without 0x01 records.

split_area

On input is array of POI hashrefs. This array must be without 0x01 records - use deareizator. Output is reference to array which contains POIs organized into tree of areas. This can significantly improve speed of displaying POIs in TTN.

foreach my $i ( @pois ) {
	printf STDERR "sort: %s: %d\n", $dimension, ${$i}{$dimension};
}
printf STDERR "========================\n";

SEE ALSO

IO::File, TomTom Navigator SDK, POI file format,

AUTHOR

Petr Vranik, <hPa at SuTeren.net>

BUGS

Please report any bugs or feature requests to bug-geo-ov2 at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Geo-Ov2. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

TODO

1) Implement reading and writing poi.dat

It means operating in two modes. In mode of ov2 behavior stays the same as now. In poi.dat mode it will return hash of arrays on read and expect hash of arrays on write. The top level hash will contain categories and in each category there will be array of POIs, as returned nowadays.

2) Make Czech translations of README and INSTALL.
3) Implement seekability on POI basis.
4) Implement other IO::File methods on POI basis.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Geo::Ov2

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2007 Petr Vranik, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.