The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Geo::Yandex - Performs geographical queries using Yandex Maps API

SYNOPSIS

    # Address to search
    my $addr = 'Москва, Красная площадь, 1';
    
    # Personal API key, should be obtained at http://api.yandex.ru/maps/form.xml
    my $key = '. . .';
    
    # New geo object, note to use the key
    my $geo = new Geo::Yandex($key);
    
    # Search locations with a given address
    my @locations = $geo->location(address => $addr);
    
    # Locations are an array of Geo::Yandex::Location elements
    for my $item (@locations) {
        printf "%s\n", $item->address;
        printf "\t%s, %s (%s)\n", $item->latitude, $item->longitude, $item->kind;
    }

    

ABSTRACT

Geo::Yandex is a Perl interface for the part of Yandex Maps API which retrieves geographical data for text query.

DESCRIPTION

Yandex Maps API is a set of tools for working with http://maps.yandex.ru website both with JavaScript queries and HTTP negotiations. Full description of the interface can be found at http://api.yandex.ru/maps/doc/ (in Russian).

All the work is done by an instance of Geo::Yandex class.

new

Creates a new Geo::Yandex object. The only argument, which is required, is a personal key that should be issued by Yandex before using API. To obtain the key you need to fill the form at http://api.yandex.ru/maps/form.xml.

    my $geo = new Geo::Yandex($key);
    

location

    Launches search query to Yandex and returns the list of locations which match to the given address (passed in C<address> parameter).
    
    my @locations = $geo->location(address => $addr);
    
    The list returned by this method is combined of elements of the type Geo::Yandex::Location. If no results were found, return is an empty list.

AUTHOR

Andrew Shitov, <andy@shitov.ru>

COPYRIGHT AND LICENCE

Geo::Yandex module is a free software. You may redistribute and (or) modify it under the same terms as Perl, whichever version it is.