Google Maps and Google Places Autocomplete API with Rails, Turbolinks, and Stimulus.js Discussion
Thanks Chris, great video.
I have tried to work with Google Maps Places API in the past, but I have faced an issue with their API Policies. According to their policy you cannot save details like the place address which was autocompleted in your application database (https://developers.google.com/places/web-service/policies#pre-fetching,-caching,-or-storage-of-content). Also I remember you can save the latitude and the longitude in the database but you have to refresh it every 30 days (https://cloud.google.com/maps-platform/terms/maps-service-terms).
What are your thoughts on this?
It sounds like they more or less don't want you downloading all their data and creating your own copy. That's their way of enforcing it. There are several good alternatives that might have better licensing.
So does that mean that you are good if the app runs a place update each month? If so, for smaller apps, you are golden. The Mapbox API might be a good alternative.
Overall, thanks Chris for offering this look into how to use Google's API with rails. I haven't seen anyone put something like this together in a while.
Me too. I prefer Stimulus over all other options. Is the Rails way. So easy and useful.
Hi Chris, Great tutorial. I noticed that when you go back to edit a page, the map loads the correct location from lat and long, however, it does not place the marker back. It would be confusing for users let's say on a property details page when the page loads, it will zoom to the correct building/area but since the marker for the actual address didn't load, the user won't know which building they are looking at. Instead they are going to be looking at the whole map with other business names and their markers. In summary, when you go back to your edit page (from your screencast) it should load the marker.