wuwanahq / wuwana2

🇪🇺 Wuwana v2 - A webapp to help users find local suppliers in Spain.
Mozilla Public License 2.0
2 stars 2 forks source link

Google Place API #145

Open levogirar opened 3 years ago

levogirar commented 3 years ago

Problem

Currently, we have very little information in our website. A easy way to add more data is through Google.

Solution

I propose to use the Google Place API. Google Cloud allow for $200 monthly free API calls, and for Place Details, it is $17 per 1000 calls. We should make the call, then store the result in our database.

How will it work?

When we create a new company, there will be a field to write manually the Place ID. The following tool can help us find the Place ID for any company, Place ID Finder. In the future, we could look for a way to make this automatic (see Place Searches).

In the company database, we can add a new field called Google Place. Here, we store the following:

From all these, we can create the following:

Screen Shot 2021-03-01 at 14 41 31

NB: we will use LEAFLET.JS and OPEN STREET MAP to create the map.

FAQ

1. How often do we update the information? In order to save on cost, we should do it once a week. This type of information seldom changes (except for the reviews). 2. What happens if we do not have the company Place ID? I think we should use a conditional to display the component. If the field is empty, do not show the Google Maps component.

kakaye-mkubwa commented 3 years ago

What should be developed in this issue is:

  1. Create a GooglePlace table
  2. Create geometry and reviews table and link them to GooglePlace table.
  3. Create a field for placeID in the existing Company table (linking GooglePlace table and company)
  4. Create php functions to query the Google Place API and fetch and store the data in the database

I suppose this is what should be done in this case @levogirar

levogirar commented 3 years ago

@kakaye-mkubwa it looks good. One question:

kakaye-mkubwa commented 3 years ago

I can create indepedent lat and long columns in the GooglePlace table instead of creating geometry table

levogirar commented 3 years ago

Great! I prefer this.