Geo::Ov2 - Library for reading and writing TomTom Navigator .ov2 POI files.
Extends IO::File
Version 0.91
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 )};
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.
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.
This is a getter and setter of deareize flag for specific instance of object.
This is a getter and setter of repartition flag for specific instance of object.
This is a getter and setter of repart_size value for specific instance of object.
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.
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" }
This method reads data from ov2 file and returns hashref into POI structure:
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.
This method reads the whole ov2 file and returns array of hashrefs into POI structures.
This method expects array of hashrefs into POIs and returns structure of 0x01 record, which is area for these POIs.
This method expects array of POI hashrefs on input and rturns reference to array which is copy of source array, but without 0x01 records.
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";
IO::File, TomTom Navigator SDK, POI file format,
Petr Vranik, <hPa at SuTeren.net>
<hPa at SuTeren.net>
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.
bug-geo-ov2 at rt.cpan.org
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.
You can find documentation for this module with the perldoc command.
perldoc Geo::Ov2
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Geo-Ov2
CPAN Ratings
http://cpanratings.perl.org/d/Geo-Ov2
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Geo-Ov2
Search CPAN
http://search.cpan.org/dist/Geo-Ov2
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.
To install Geo::Ov2, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Geo::Ov2
CPAN shell
perl -MCPAN -e shell install Geo::Ov2
For more information on module installation, please visit the detailed CPAN module installation guide.