Google Places

Plugin Horizon Google Places is able to search places around the certain location and then save them into CSV file. All these information are collected from Google Places service. Please make sure that you have Google account and the Google Maps API is enabled.

Before fetching the places please note that google has daily limit for queries. You can make 1000 queries per day or 150000 queries when you are identified user.

You can find more information regarding the daily limits here https://developers.google.com/places/web-service/usage

Maximum number of places fetched from Google Places service is 200 by using radar search. If you want find another places you must change search criteria and move the radar search location.

Before starting to work with the Google Places please read their policies https://developers.google.com/places/web-service/policies

After enabling Horizon Google Places plugin new command for WP CLI will be avialable.

WP CLI Installation

You need to run these command in terminal. Make sure that your hosting provider support SSH connections.

$ curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
$ php wp-cli.phar --info
$ chmod +x wp-cli.phar
$ sudo mv wp-cli.phar /usr/local/bin/wp

Getting API key

Here are few links how to get the API key

https://developers.google.com/maps/documentation/business/places/ https://developers.google.com/maps/documentation/business/places/auth

  1. Log in into Google Developer Console console.developers.google.com
  2. Create new project
  3. Under API Manager enable Google Places API Web Service
  4. Navigate into Credentials
  5. Click on Add Credentials - API Key
../_images/google-places-api.png

Obtaing Places

List of columns avaialable in CSV file:

name, latitude, longitude, rating, price_level, icon, types, formatted_address, vicinity, url, website, formatted_phone_number, international_phone_number, id, html_attributions

Command:

wp horizon-google-places radarsearch --location=40.738095,-73.991360 --radius=500 --api-key=YourApiKey --output=results.csv --types=restaurant
–location:is the latitude and longitude for the position where you want to start searching the places.
–radius:defines the distance from the center in meters. Max valie is 50 000 meters.
–api-key:your API key found in Google Console.
–types:argument for querying only specific places. Multiple types separate by comma. Here is the full list of avaialble types https://developers.google.com/places/supported_types
–output:the file where the results will be saved. Default folder is wp-content/horizon.