Proximity search allows your customers to search for events near to their location.
Here's an example using the national parks of America:
Proximity search requires a Google Maps Api Key.
There's a couple of steps to get your API key, but it shouldn't take more than 5 minutes. It's also free!
Google summaries it in these five steps:
- Go to the Google Cloud Platform Console.
- From the Project drop-down menu, select or create the project for which you want to add an API key.
- From the Navigation menu, select APIs & Services > Credentials.
- On the Credentials page, click Create credentials > API key. The API key created dialog displays your newly created API key (an encrypted string).
- Click Close. The new API key is listed on the Credentials page under API keys. (Remember to restrict the API key before using it in production.)
If that's enough for you then great! Otherwise, here's some detailed steps:
- Go to the Google Cloud Platform Console. You'll be greeted with a page that looks like this:
2. Create a new project. To do that, click the drop down at the top where it says 'select a project' and click 'new project' on the modal that appears. You should then come to this screen:
Call your project whatever takes your fancy and click create.
It will now take you back to the Google Cloud homepage. Select your new project using the top dropdown:
When your project is selected you will then see this screen:
3). We now need to active the Geocoding library.
Open the navigation on the left (by click the three rectangular bars at the top left hand corner). Select APIs & Services > Library:
Type Geocoding in the search bar that appears:
And select the Geocoding api. It should be the first result:
You should then get taken to the Geocoding page:
Great! Nearly there!
4) Activate billing
Google annoyingly requires that you add a credit card to the account. They promise never to charge it (unless you tell them to), but say they need it to make sure you're a real person.
If you decide not to add a credit card, unfortunately it wont work.
Their pricing is confusing, but you basically get $200 worth of free usage a month. It's highly highly unlikely that you're ever going to go over this. But if you do, remember Google still won't charge you unless you give them permission.
Go back to the navigation and select billing:
On the next screen select Link a billing account:
You can then follow the steps through to add your credit card to the account.
5) Get your api key
Back to the navigation and we want to select APIs & Services -> Credentials
You will then see this screen:
Click 'Create credentials' and then select Api Key.
You should then be able to get an API key that looks like this:
6) Add the key to your setting inside Event Calendar App
Head over to your settings page and paste in the API key in the Google Maps Api Key area.
7) Active Proximity Search
You should now be able to activate Proximity search in your editor
All done! Let's quickly test that it all works:
Type an address in the location box and hit enter. You should see something like this:
Notice how it shows how far away the event is from the location. If you don't see any distance, there may be a problem with your API key.
...and we're done.
I completely understand that was slightly long winded. However, the good news is that you only ever have to do it once.
If there is anything I can help with, or if you have any trouble at all. Please just get in touch! 👍