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
- Log in into Google Developer Console console.developers.google.com
- Create new project
- Under API Manager enable Google Places API Web Service
- Navigate into Credentials
- Click on Add Credentials - API Key
List of columns avaialable in CSV file:
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.|