Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storing Data from Google Places API

Please don't mind if this question sounds a little silly!

I am trying to learn more about Google Places API. I am interested in doing an implementation similar to airbnb.com (check the search function at the top, it shows "powered by google" in autosuggest).

In our Address Form, we planned to use the autosuggest feature provided by Google Places API for filling the city, region and country (e.g https://www.airbnb.com/rooms/new)

Questions

1) Once someone selects a Place in the "City" field, what exactly are we allowed to store in ourdatabase from the fetched Google data? Can we store the city name, its region, its country, co-ordinates, etc in our database?

2) What about URLs? When browsing for rooms, the URLs generated on airbnb site are of the format 'CITY--REGION' (e.g. www.airbnb.com /s/Auckland--New-Zealand)

We would like to do something similar. For this too, wouldn't we need to store a unique url (based on some formula) for each fetched Place?

3) In our project, we would even like to generate breadcrumbs. e.g. You are here: Oceania > New Zealand > Otago > Queenstown

When we fetch a city, can we store its region and administrative areas?

4) What is a unique identifier for any Google Place, is it ID or Reference, it is not too clear from the documentation https://developers.google.com/maps/documentation/javascript/places#place_details_results

Any database schemas of such similar sites would be truly appreciated!

Thanks!

like image 496
user3302879 Avatar asked Feb 12 '14 18:02

user3302879


People also ask

Can you store Google places API data?

Customer can temporarily cache latitude (lat) and longitude (lng) values from the Places API for up to 30 consecutive calendar days, after which Customer must delete the cached latitude and longitude values. Customer can cache Places API Place ID (place_id) values, in accordance with the Places API Policies.

How do I get data from Google Maps places API?

Go to APIs & Services → Dashboard → Enable APIs & Services at the top and Choose Maps Javascript API from the API Library. This will open up the Map JavaScript API page, and Enable it.

What can you do with Google places API?

The Places API lets you search for place information using a variety of categories, including establishments, prominent points of interest, and geographic locations. You can search for places either by proximity or a text string.

Can I use places API without billing?

Google Place APIs require billing. When you use these APIs it gives you some limited requested free then you have to enable billing.


2 Answers

  1. I've read pretty much all of Places API's documentation and I have never once seen restrictions on what and what not you are allowed to store in a database. I would however recommend just storing the locations "reference" ID and just getting the details view HTTP every time so if a location's info changes, you are kept up-to-date.

  2. Of course you can do that, Google doesn't own country names :P

  3. Again, I would recommend storing the reference and accessing the location that way.

  4. A Place only has one ID. When you get the details of a place that ID will be returned every time. A reference, however, varies with each request. You cannot use an ID to get details about a Place but you can use a reference. An ID is useful for comparing places to see if they are the same as a location only has one ID.

Keep the storage as light as possible. Keep only Place references and maybe IDs.

like image 87
Windwaker Avatar answered Sep 20 '22 03:09

Windwaker


You can find here: https://developers.google.com/places/place-id#find-id

Save place IDs for later use

Place IDs are exempt from the caching restrictions stated in Section 10.1.3 of the Google Maps APIs Terms of Service. You can therefore store place ID values indefinitely.

This supports the answer given by Windwaker, that the place ID is the right, and only legal thing you may store permanently.

like image 24
amirey Avatar answered Sep 20 '22 03:09

amirey