NAME

URI::geo - The geo URI scheme.

VERSION

This document describes URI::geo version 0.02

SYNOPSIS

use URI;

# GeoURI from text
my $guri = URI->new( 'geo:54.786989,-2.344214' );

# From coordinates
my $guri = URI::geo->new( 54.786989, -2.344214 );

DESCRIPTION

From http://geouri.org/:

More and more protocols and data formats are being extended by methods
to add geographic information. However, all of those options are tied
to that specific protocol or data format.

A dedicated Uniform Resource Identifier (URI) scheme for geographic
locations would be independent from any protocol, usable by any
software/data format that can handle generich URIs. Like a "mailto:"
URI launches your favourite mail application today, a "geo:" URI could
soon launch your favourite mapping service, or queue that location for
a navigation device.

Try hard to extract location information from something. We handle lat, lon, alt as scalars, arrays containing lat, lon, alt, hashes with suitably named keys and objects with suitably named methods.

INTERFACE

new

Create a new URI::geo. The arguments should be either

  • latitude, longitude and optionally altitude

  • a reference to an array containing lat, lon, alt

  • a reference to a hash with suitably named keys

  • a reference to an object with suitably named accessors

To maximise the likelyhood that you can pass in some object that represents a geographical location and have URI::geo do the right thing we try a number of different accessor names.

If the object has a latlong method (eg Geo::Point) we'll use that. If there's a location method we call that. Otherwise we look for accessors called lat, latitude, lon, long, longitude, ele, alt, elevation or altitude and use them.

Often if you have an object or hash reference that represents a point you can pass it directly to new.

location

Get or set the location of this geo URI.

my ( $lat, $lon, $alt ) = $guri->location;
$guri->location( 55.3, -3.7, 120 );

When setting the location it is possible to pass any of the argument types that can be passed to new.

latitude

Get or set the latitude of this geo URI.

longitude

Get or set the longitude of this geo URI.

altitude

Get or set the altitude of this geo URI.

DEPENDENCIES

URI

BUGS AND LIMITATIONS

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

AUTHOR

Andy Armstrong <andy@hexten.net>

LICENCE AND COPYRIGHT

Copyright (c) 2009, Andy Armstrong <andy@hexten.net>.

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