Mohammad S Anwar > WWW-Google-Places-0.04 > WWW::Google::Places

Download:
WWW-Google-Places-0.04.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.04   Source   Latest Release: WWW-Google-Places-0.10

NAME ^

WWW::Google::Places - Interface to Google Places API.

VERSION ^

Version 0.04

DESCRIPTION ^

The Google Places API is a service that returns information about Places, defined within this API as establishments, geographic location or prominent points of interest using HTTP request. Place requests specify locations as latitude/longitude coordinates. Users with an API key are allowed 1,000 requests per 24 hour period. Currently it supports version v3.

PLACE TYPES ^

Supported types for Place Searches and Place adds.

    +-------------------------+
    | accounting              |
    | airport                 |
    | amusement_park          |
    | aquarium                |
    | art_gallery             |
    | atm                     |
    | bakery                  |
    | bank                    |
    | bar                     |
    | beauty_salon            |
    | bicycle_store           |
    | book_store              |
    | bowling_alley           |
    | bus_station             |
    | cafe                    |
    | campground              |
    | car_dealer              |
    | car_rental              |
    | car_repair              |
    | car_wash                |
    | casino                  |
    | cemetery                |
    | church                  |
    | city_hall               |
    | clothing_store          |
    | convenience_store       |
    | courthouse              |
    | dentist                 |
    | department_store        |
    | doctor                  |
    | electrician             |
    | electronics_store       |
    | embassy                 |
    | establishment           |
    | finance                 |
    | fire_station            |
    | florist                 |
    | food                    |
    | funeral_home            |
    | furniture_store         |
    | gas_station             |
    | general_contractor      |
    | geocode                 |
    | grocery_or_supermarket  |
    | gym                     |
    | hair_care               |
    | hardware_store          |
    | health                  |
    | hindu_temple            |
    | home_goods_store        |
    | hospital                |
    | insurance_agency        |
    | jewelry_store           |
    | laundry                 |
    | lawyer                  |
    | library                 |
    | liquor_store            |
    | local_government_office |
    | locksmith               |
    | lodging                 |
    | meal_delivery           |
    | meal_takeaway           |
    | mosque                  |
    | movie_rental            |
    | movie_theater           |
    | moving_company          |
    | museum                  |
    | night_club              |
    | painter                 |
    | park                    |
    | parking                 |
    | pet_store               |
    | pharmacy                |
    | physiotherapist         |
    | place_of_worship        |
    | plumber                 |
    | police                  |
    | post_office             |
    | real_estate_agency      |
    | restaurant              |
    | roofing_contractor      |
    | rv_park                 |
    | school                  |
    | shoe_store              |
    | shopping_mall           |
    | spa                     |
    | stadium                 |
    | storage                 |
    | store                   |
    | subway_station          |
    | synagogue               |
    | taxi_stand              |
    | train_station           |
    | travel_agency           |
    | university              |
    | veterinary_care         |
    | zoo                     |
    +-------------------------+

Additional types listed below can be used in Place Searches, but not when adding a Place.

    +-----------------------------+
    | administrative_area_level_1 |
    | administrative_area_level_2 |
    | administrative_area_level_3 |
    | colloquial_area             |
    | country                     |
    | floor                       |
    | intersection                |
    | locality                    |
    | natural_feature             |
    | neighborhood                |
    | political                   |
    | point_of_interest           |
    | post_box                    |
    | postal_code                 |
    | postal_code_prefix          |
    | postal_town                 |
    | premise                     |
    | room                        |
    | route                       |
    | street_address              |
    | street_number               |
    | sublocality                 |
    | sublocality_level_4         |
    | sublocality_level_5         |
    | sublocality_level_3         |
    | sublocality_level_2         |
    | sublocality_level_1         |
    | subpremise                  |
    | transit_station             |
    +-----------------------------+

LANGUAGES ^

    +-------+-------------------------+
    | Code  | Name                    |
    +-------+-------------------------+
    | ar    | ARABIC                  |
    | eu    | BASQUE                  |
    | bg    | BULGARIAN               |
    | bn    | BENGALI                 |
    | ca    | CATALAN                 |
    | cs    | CZECH                   |
    | da    | DANISH                  |
    | de    | GERMAN                  |
    | el    | GREEK                   |
    | en    | ENGLISH                 |
    | en-AU | ENGLISH (AUSTRALIAN)    |
    | en-GB | ENGLISH (GREAT BRITAIN) |
    | es    | SPANISH                 |
    | eu    | BASQUE                  |
    | fa    | FARSI                   |
    | fi    | FINNISH                 |
    | fil   | FILIPINO                |
    | fr    | FRENCH                  |
    | gl    | GALICIAN                |
    | gu    | GUJARATI                |
    | hi    | HINDI                   |
    | hr    | CROATIAN                |
    | hu    | HUNGARIAN               |
    | id    | INDONESIAN              |
    | it    | ITALIAN                 |
    | iw    | HEBREW                  |
    | ja    | JAPANESE                |
    | kn    | KANNADA                 |
    | ko    | KOREAN                  |
    | lt    | LITHUANIAN              |
    | lv    | LATVIAN                 |
    | ml    | MALAYALAM               |
    | mr    | MARATHI                 |
    | nl    | DUTCH                   |
    | no    | NORWEGIAN               |
    | pl    | POLISH                  |
    | pt    | PORTUGUESE              |
    | pt-BR | PORTUGUESE (BRAZIL)     |
    | pt-PT | PORTUGUESE (PORTUGAL)   |
    | ro    | ROMANIAN                |
    | ru    | RUSSIAN                 |
    | sk    | SLOVAK                  |
    | sl    | SLOVENIAN               |
    | sr    | SERBIAN                 |
    | sv    | SWEDISH                 |
    | tl    | TAGALOG                 |
    | ta    | TAMIL                   |
    | te    | TELUGU                  |
    | th    | THAI                    |
    | tr    | TURKISH                 |
    | uk    | UKRAINIAN               |
    | vi    | VIETNAMESE              |
    | zh-CN | CHINESE (SIMPLIFIED)    |
    | zh-TW | CHINESE (TRADITIONAL)   |
    +-------+-------------------------+

CONSTRUCTOR ^

The constructor expects your application API Key and sensor at the least which you can get it for FREE from Google.

    +-----------+--------------------------------------------------------------------------------------+
    | Parameter | Meaning                                                                              |
    +-----------+--------------------------------------------------------------------------------------+
    | api_key   | Your application API key. You should supply a valid API key with all requests. Get a |
    |           | key from the Google APIs console. This must be provided.                             |
    | sensor    | Indicates whether or not the Place request came from a device using a location sensor|
    |           | (e.g. a GPS) to determine the location sent in this request. This value must be      |
    |           | either true or false. This must be provided.                                         |
    | language  | The language code, indicating in which language the results should be returned. The  |
    |           | default is en.                                                                       |
    | output    | Output format JSON or XML. Default is JSON.                                          |
    +-----------+--------------------------------------------------------------------------------------+

    use strict; use warnings;
    use WWW::Google::Places;

    my ($api_key, $sensor, $google);
    $api_key = 'Your_API_Key';
    $sensor  = 'true';

    $google  = WWW::Google::Places->new($api_key, $sensor);
    # or
    $google  = WWW::Google::Places->new({'api_key'=>$api_key, sensor=>$sensor});
    # or
    $google  = WWW::Google::Places->new({'api_key'=>$api_key, sensor=>$sensor, language=>'en', output=>'json'});

METHODS ^

search_place()

Searches place.

    +----------+--------------------------------------------------------------------------------+
    | Key      | Description                                                                    |
    +----------+--------------------------------------------------------------------------------+
    | location | The latitude/longitude around which to retrieve Place information. This must be|
    |          | provided as a google.maps.LatLng object. This must be provided.                |
    | radius   | The distance (in meters) within which to return Place results. The recommended |
    |          | best practice is to set radius based on the accuracy of the location signal as |
    |          | given by the location sensor. Note that setting a radius biases results to the |
    |          | indicated area, but may not fully restrict results to the specified area. This |
    |          | must be provided.                                                              |
    | types    | Restricts the results to Places matching at least one of the specified types.  |
    |          | Types should be separated with a pipe symbol.                                  |
    | name     | A term to be matched against the names of Places.                              |
    +----------+--------------------------------------------------------------------------------+

    use strict; use warnings;
    use WWW::Google::Places;

    my ($api_key, $sensor, $google, $places);
    $api_key = 'Your_API_Key';
    $sensor  = 'true';
    $google  = WWW::Google::Places->new($api_key, $sensor);
    $places  = $google->search_place(location=>'-33.8670522,151.1957362', radius=>500);

place_detail()

A Place Details request returns more comprehensive information about the indicated place such as its complete address, phone number, user rating, etc.

    +-----------+--------------------------------------------------------------------------------+
    | Key       | Description                                                                    |
    +-----------+--------------------------------------------------------------------------------+
    | reference | A textual identifier that uniquely identifies a place, returned from a Place   |
    |           | search request. This must be provided.                                         |
    +-----------+--------------------------------------------------------------------------------+

    use strict; use warnings;
    use WWW::Google::Places;

    my ($api_key, $sensor, $reference, $google, $detail);
    $api_key   = 'Your_API_Key';
    $sensor    = 'true';
    $reference = 'Place_reference';
    $google    = WWW::Google::Places->new($api_key, $sensor);
    $detail    = $google->place_detail($reference);

place_checkins()

It indicates that a user has checked in to that Place. Check-in activity from your application is reflected in the Place search results that are returned - popular establishments are ranked more highly making it easy for your users to find likely matches. As check-in activity changes over time, so does the ranking of each Place.

    +-----------+--------------------------------------------------------------------------------+
    | Key       | Description                                                                    |
    +-----------+--------------------------------------------------------------------------------+
    | reference | A textual identifier that uniquely identifies a place, returned from a Place   |
    |           | search request. This must be provided.                                         |
    +-----------+--------------------------------------------------------------------------------+

    use strict; use warnings;
    use WWW::Google::Places;

    my ($api_key, $sensor, $reference, $google, $checkins);
    $api_key   = 'Your_API_Key';
    $sensor    = 'true';
    $reference = 'Place_reference';
    $google    = WWW::Google::Places->new($api_key, $sensor);
    $checkins  = $google->place_checkins($reference);

add_place()

Add a place to be available for any future search place request.

    +----------+--------------------------------------------------------------------------------+
    | Key      | Description                                                                    |
    +----------+--------------------------------------------------------------------------------+
    | location | The latitude/longitude around which to retrieve Place information. This must   |
    |          | be provided as a google.maps.LatLng object.                                    |
    | accuracy | The accuracy of the location signal on which this request is based, expressed  |
    |          | in meters. This must be provided.                                              |
    | name     | The full text name of the Place.                                               |
    | types    | Restricts the results to Places matching at least one of the specified types.  |
    |          | Types should be separated with a pipe symbol.                                  |
    +----------+--------------------------------------------------------------------------------+

    use strict; use warnings;
    use WWW::Google::Places;

    my ($api_key, $sensor, $google, $status);
    $api_key = 'Your_API_Key';
    $sensor  = 'true';
    $google  = WWW::Google::Places->new($api_key, $sensor);
    $stetus  = $google->add_place('location'=>'-33.8669710,151.1958750', accuracy=>40, name=>'Google Shoes!');

delete_place()

Delete a place as given reference. Place can only be deleted by the same application that has added it in the first place. Once moderated and added into the full Place Search results, a Place can no longer be deleted. Places that are not accepted by the moderation process will continue to be visible to the application that submitted them.

    +-----------+--------------------------------------------------------------------------------+
    | Key       | Description                                                                    |
    +-----------+--------------------------------------------------------------------------------+
    | reference | A textual identifier that uniquely identifies a place, returned from a Place   |
    |           | search request. This must be provided.                                         |
    +-----------+--------------------------------------------------------------------------------+

    use strict; use warnings;
    use WWW::Google::Places;

    my ($api_key, $sensor, $reference, $google, $status);
    $api_key   = 'Your_API_Key';
    $sensor    = 'true';
    $reference = 'Place_reference';
    $google    = WWW::Google::Places->new($api_key, $sensor);
    $status    = $google->delete_place($reference);

AUTHOR ^

Mohammad S Anwar, <mohammad.anwar at yahoo.com>

BUGS ^

Please report any bugs/feature requests to bug-www-google-places at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Google-Places. I will be notified and then you will 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 WWW::Google::Places

You can also look for information at:

LICENSE AND COPYRIGHT ^

Copyright 2011 Mohammad S Anwar.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

DISCLAIMER ^

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

syntax highlighting: