Integrate with Google Maps API for location search

Issue #130 new
Igor Santos created an issue

https://developers.google.com/maps/documentation/javascript/places-autocomplete

We need to think on a way to provide event location for two reasons:

event address + event map

For this, there's the event_addresses table. This should be pretty straightforward: the user types in an address, Google autocompletes it for us, as get the metadata and store it in the table. The table might need to store additional data so it becomes easier to display the map - maybe just sending the address would be enough, though.

Question: will we allow users to freetype addresses, without relating them to Google API? This could be useful for complicate addresses, such as including a floor or room, but could make it harder to geolocate later. An idea would be to use the autocomplete as a "CEP autocomplete", where the user types in the beginning of the address, selects one, and it autocompletes the following fields, which will then populate the event_addresses table. The place_id would be stored as well so we can easily retrieve the map area without having issues with address formats or complements (floor/etc).

notifications of interesting events in a given area

Here, the locations table should be used. We should take into account that a city place_id can be used both in the events table and following_theme, at the bare minimum.

Should we populate new used locations from Google into locations and create the relations, or simply cache what's given by Google and store the place_id without a real reference in the tables?

If we populate, we would do the following:

  1. user types in part of a place in the search box (for event creation or theme notification change)
  2. google autocomplete API retrieves a place for us if there's no location.place_id in the table, we insert in
  3. we use the location.id as the FK

Question: would we need the place_id to be FK as well, or use it as the main ID? What would place_id be used for?

Comments (1)

  1. Log in to comment