Jeff Anderson > Geo-Coder-Canada > Geo::Coder::Canada

Download:
Geo-Coder-Canada-0.01.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.01   Source  

NAME ^

Geo::Coder::Canada - Perl extension for getting longitude and latitude cordinates given a Canadian address. Also, provides reverse geocoding to return the nearest shipping address given a longitude and latitude point.

SYNOPSIS ^

  use Geo::Coder::Canada;
  
  my $g = Geo::Coder::Canada->new;

  # Standard Geocoding...
  $g->addresst('Main St');
  $g->stno(100);
  $g->city('Toronto');
  $g->prov('ON');
  $g->postal('M4E2V8');
  if ($g->geocode) {
    my $latitude  = $g->latt;
    my $longitude = $g->long;
  }
  else {
    my $error_msg = $g->error->message;
  }

  # Intersection geocoding...
  $g->street1('Burrard Street');
  $g->street2('Robson Street');
  $g->city('Vancouver');
  $g->prov('BC');
  $g->intersection_geocode;

  # Reverse geocoding...
  $g->latt(45.44);
  $g->long(-75.7);
  $g->reverse_geocode;

DESCRIPTION ^

This module provides a Perl frontend for the geocoder.ca website XML API. It allows the programmer to convert from street address information to longitude and latitude coordinates as well as the reverse function. This module also provides some extra features like defining an address using a nearby cross street intersections and determining a the postal code for an address.

METHODS ^

new()

Returns a new Geo::Coder::Canada object.

geocode()

Send the address information to geocoder.ca and return the Geo::Coder::Canada::Response object. You are required to set the addresst, stno, city and prov methods or the postal method before calling geocode().

reverse_geocode()

Send the latt/long values to geocoder.ca and return a Geo::Coder::Canada::Response object. You are required to enter street1, street2, city and prov methods before calling geocode().

intersection_geocode()

Send the intersection address information and return a Geo::Coder::Canada::Response object. You are required to set the latt and long methods before calling intersection_geocode().

geo_response()

Contains a reference to the Geo::Coder::Canada::Response object (in case you missed it during the request call)

error()

Contains a reference to the Geo::Coder::Canada::Error object. This is only set when the original geocode request failed.

ATTRIBUTES ^

addresst(), stno(), street1(), street2(), city(), prov(), locate(), postal()

These methods contain basic get/set methods and provide no validation.

decimal()

An optional parameter to limit the number of decimal places in the lat and long response values.

id()

An optional value you can set which is returned back as sent. Used to match requests to response values?

recompute()

Optional value to produce better accuracy on longitude and latitude values. Although this is not assured. See the geocoder.ca site for more information.

showpostal()

Optional value to set if you have not given a postal address. in this case the postal address will be returned by geocoder.ca and available in the response object. Only the values 1 or 0 are valid.

latt()

A decimal input value representing the latitude of the address.

long()

A decimal input value representing the longitude of the address.

REQUIREMENTS ^

XML::Simple, LWP::UserAgent, HTTP::Request, URI

AUTHOR ^

Jeff Anderson, jeff@pvrcanada.com

Copyright (c) 2006 Jeff Anderson. All rights reserved. This program is free software; you can redistribut it and/or modify it under the same terms as Perl itself.

SEE ALSO ^

Geo::Coder::Canada::Response, Geo::Coder::Canada::Error

syntax highlighting: