Ask A Question

Notifications

You’re not receiving notifications from this thread.

Create a filterable location based database with Google Maps API?

Charles Ogar asked in Databases

I’m not sure exactly how to word the functionality of what I’m trying to build but let to give it a shot here to see if someone has built or seen something similar

I’m working on a web app that will basically be a huge database of dance events across the world. So I naturally would need to be able to create location column to the events database I’m building. I’m not sure the best way to go about it.

The functionality of what I’m trying to replicate exists on Airbnb. Airbnb has a giant list of their listings across the world. From their search bar you can search any city, state, country, or continent and there’s an autocomplete functionality that matches what was typed in to then filter the listings by that geographic region.

I’ve done some research online with Google Places API and it seems with the Places ID I can get the latlng (latitude and longitude) data of each venue, city, state, country and then continent. I’m not interested to setting up a map view right now, and there’s seems to be a lot of tutorials geared towards the map view with Google API.

I’m looking for creating a database record for my events, being able to extract the needed data for the location that will then open up the possibility of “scalable” filtering via city, state, country, or continent.

If I get the autocomplete function to work on my event creation form, would I then be able to pull data from Google and save that to my database?

Some example queries could be:

  • Show me salsa events happening in Berlin
  • Show me west coast swing events in Japan
  • Show me bachata events in Texas

I’m not sure if I’m using the right terms. any advice or guidance is greatly appreciated! I’d even be willing to pay someone for mentorship to create this function in my Rails app.

Reply

Before using the Geocoding service in the Maps JavaScript API, first ensure that the Geocoding API is enabled in the Google Cloud Console, in the same project you set up for the Maps JavaScript API.

To view your list of enabled APIs:

1.Go to the Google Cloud Console.

2.Click the Select a project button, then select the same project you set up for the Maps JavaScript API and click Open.

3.From the list of APIs on the Dashboard, look for Geocoding API.

4.If you see the API in the list, you’re all set. If the API is not listed, enable it:

 4.1..At the top of the page, select ENABLE API to display the Library tab. Alternatively, from the left side menu, select 
  Library.

 4.2.Search for Geocoding API, then select it from the results list.

4.3Select ENABLE. When the process finishes, Geocoding API appears in the list of APIs on the Dashboard.
Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,329+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.