I'm building a mobile app that lists posts, each post has a place attached to it.
I want the list to be able to show distance from the user's location. without caching anything it would require to store the place reference for each post and while listing fetch the place's geometry from Google Places API, this sounds like a very bad idea.
am I allowed to store the place's id, reference, name and geometry in my db and deliver it with my API? this is for performance purposes only
another implementation might be to cache this data in a local sqlite db on the mobile device, but then the user will have to download the information for each uncached place so for a list of X different places the client will be doing X api calls, sounds slow and battery wasting.
am I allowed to have a central cache in my db in a table that'll be refreshed every once in a while and evicted if not accessed for lets say 30 days ?
Applications using the Places API are bound by the terms of your Agreement with Google. Subject to the terms of your Agreement, you must not pre-fetch, index, store, or cache any Content except under the limited conditions stated in the terms.
The documentation says that the Places API returns up to 20 results. It does not indicate that there is any way to change that limit. So, the short answer seems to be: You can't. Of course, you might be able to sort of fake it by doing queries for several locations, and then merging/de-duplicating the results.
IMHO you can't cache it. The API script calls objects on the Google server. At most, you can capture the results and cache them as images (but then you lose interactivity).
How Does Google Maps Platform Places API Work? Places API uses HTTP requests to enable your application to return definitive information about places. These places are defined by the API as geographic locations, establishments or notable points of interest.
Google's page on Places states that Caching of the Places ID is allowed.
The terms in 10.5.d state that you may store limited amounts of content for no more than 30 calendar days for performance reasons. Since this is what you are trying to do, then I would expect that you are ok to store the ID, location and name.
As you start to cache more information then you'll breach the terms of the API. It's not too clear what these are but I think as long as you are being reasonable then you'll be OK.
As per the current policy, the Place Id is exempt from the caching restriction.
Pre-Fetching, Caching or Storage of contents
Pre-Fetching, Caching, or Storage of Content Applications using the Directions API are bound by the Google Maps Platform Terms of Service. Section 3.2.4(a) of the terms states that you must not pre-fetch, cache, index, or store any Content except under the limited conditions stated in the terms.
Note that the place ID, used to uniquely identify a place, is exempt from the caching restriction. You can therefore store place ID values indefinitely. Place ID values are returned in the place_id field in Directions API responses.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With