NAME

Geo::Coder::Bing - Geocode addresses with the Bing Maps API

SYNOPSIS

    use Geo::Coder::Bing;

    my $geocoder = Geo::Coder::Bing->new;
    my $location = $geocoder->geocode(
        location => 'Hollywood and Highland, Los Angeles, CA'
    );

DESCRIPTION

The Geo::Coder::Bing module provides an interface to the Bing Maps geocoding service, via the Ajax API.

METHODS

new

    $geocoder = Geo::Coder::Bing->new()

Creates a new geocoding object.

Accepts an optional ua parameter for passing in a custom LWP::UserAgent object.

geocode

    $location = $geocoder->geocode(location => $location)
    @locations = $geocoder->geocode(location => $location)

In scalar context, this method returns the first location result; and in list context it returns all locations results.

Each location result is a hashref; a typical example looks like:

    {
        'BestLocation' => {
            'Precision'   => 0,
            'Coordinates' => {
                'Longitude' => '-118.338669106725',
                'Latitude'  => '34.1015635823646'
            }
        },
        'Locations' => [
            {
                'Precision'   => 0,
                'Coordinates' => {
                    'Longitude' => '-118.338669106725',
                    'Latitude'  => '34.1015635823646'
                }
            }
        ],
        'CountryRegion' => 244,
        'Address'       => {
            'PostalCode'    => '90028',
            'CountryRegion' => 'United States',
            'AdminDistrict' => 'CA',
            'FormattedAddress' =>
                'Hollywood Blvd & N Highland Ave, Los Angeles, CA 90028',
            'Locality'    => 'Los Angeles',
            'AddressLine' => 'Hollywood Blvd & N Highland Ave',
            'PostalTown'  => '',
            'District'    => ''
        },
        'MatchCode' => 1,
        'Type'      => 155,
        'Shape'     => undef,
        'BestView'  => {
            'Type'            => 0,
            'NorthEastCorner' => {
                'Longitude' => '-118.323121333557',
                'Latitude'  => '34.1112203763297'
            },
            'SouthWestCorner' => {
                'Longitude' => '-118.354216879894',
                'Latitude'  => '34.0919067883995'
            },
            'Center'          => {
                'Longitude' => '-118.338669106725',
                'Latitude'  => '34.1015641333754'
            }
        },
        'MatchConfidence' => 0,
        'Name' => 'Hollywood Blvd & N Highland Ave, Los Angeles, CA 90028'
    }

ua

    $ua = $geocoder->ua()
    $ua = $geocoder->ua($ua)

Accessor for the UserAgent object.

SEE ALSO

http://www.microsoft.com/maps/isdk/ajax/

Geo::Coder::Google, Geo::Coder::Mapquest, Geo::Coder::Multimap, Geo::Coder::Yahoo

REQUESTS AND BUGS

Please report any bugs or feature requests to http://rt.cpan.org/Public/Bug/Report.html?Queue=Geo-Coder-Bing. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

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

    perldoc Geo::Coder::Bing

You can also look for information at:

COPYRIGHT AND LICENSE

Copyright (C) 2009 gray <gray at cpan.org>, all rights reserved.

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

AUTHOR

gray, <gray at cpan.org>