Andy Armstrong > Geo-Lookup-ByTime-0.10 > Geo::Lookup::ByTime

Download:
Geo-Lookup-ByTime-0.10.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.10   Source  

NAME ^

Geo::Lookup::ByTime - Lookup location by time

VERSION ^

This document describes Geo::Lookup::ByTime version 0.10

SYNOPSIS ^

    use Geo::Lookup::ByTime;
    
    $lookup = Geo::Lookup::ByTime->new( @points );
    my $pt = $lookup->nearest( $tm );

DESCRIPTION ^

Given a set of timestamped locations guess the location at a particular time. This is a useful operation for, e.g., adding location information to pictures based on their timestamp and a GPS trace that covers the same time period.

INTERFACE ^

new( [ points ] )

Create a new object optionally supplying a list of points. The points may be supplied as an array or as a reference to an array. Each point may be a reference to a hash containing at least the keys lat, lon and time or a reference to an object that supports accessor methods called latitude, longitude and time.

If a coderef is supplied it is assumed to be an iterator that may be called repeatedly to yield a set of points.

add_points( [ points ] )

Add points. The specification for what constitutes a point is the same as for new.

nearest( $time [ , $max_dist ] )

Return a hash indicating the estimated position at the specified time. The returned hash has lat, lon and time keys like this:

    my $best = {
        lat     => 54.29344,
        lon     => -2.02393,
        time    => $time
    };

Returns undef if the position can't be computed. By default a position will be calculated for any point that lies within the range of time covered by the reference points. Optionally $max_dist may be specified in which case undef will be returned if the closest real point is more than that many metres away from the computed point.

If the requested time coincides exactly with the timestamp of one of the points the returned point will be at the same location as the matching point. If the time falls between the timestamps of two points the returned point will be linearly interpolated from those two points.

In an array context returns a list containing the synthetic point at the specified time (i.e. the value that would be returned in scalar context), the closest real point and the distance between the two in metres

    my ($best, $nearest, $dist) = $lookup->nearest( $tm );
get_points()

Return a reference to an array containing all the points in ascending time order.

time_range()

Return as a two element list the time range from earliest to latest of the points in the index. Returns undef if the index is empty.

hav_distance($pt, ...)

Exportable function. Computes the Haversine distance in metres along the line described by the points passed in. Points must be references to hashes with keys lat and lon.

DIAGNOSTICS ^

Point hashes must have the following keys: lat, lon, time

You attempted to add as a point a hash that didn't have the necessary keys. Each point must have at least lat, lon and time.

Don't know how to add %s

Points can be added by supplying a list of objects that behave like points (i.e. have accessors called latitude, longitude and time), references to hashes with the keys lat, lon and time, iterators that return a stream of point like objects or arrays of any of the above. You tried to add something other than one of those.

BUGS AND LIMITATIONS ^

No bugs have been reported.

Please report any bugs or feature requests to bug-geo-lookup-bytime@rt.cpan.org, or through the web interface at http://rt.cpan.org.

AUTHOR ^

Andy Armstrong <andy@hexten.net>

LICENCE AND COPYRIGHT ^

Copyright (c) 2006, Andy Armstrong <andy@hexten.net>. All rights reserved.

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

DISCLAIMER OF WARRANTY ^

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

syntax highlighting: