Adding Google Places info
Over the past week, we've started working more heavily with the Google Places API. This blog post will be broken into two parts. The Meaty Part and The Nerdy Part. If you just want to know what has been updated, but want to be spared the nerdy details, just read The Meaty Part. If you want to know exactly what is going on behind the scenes, read both parts.
The Meaty Part
We've added two new items that should help your Beer Mapping experience.
The first thing we've added is Operating Hours pulled from Google Places. So far, we've found this to be a pretty reliable piece of information. We're going to be updating this on a weekly basis, so if a bar owner updates their hours on google, it should be reflected on our site within a week.
Here's an example of where you can find Operating Hours for a place on our location pages (mobile example).
The second thing we've added to the Beer Mapping Project database is scores from Google Reviews. Currently we're still favoring reviews from our own users, but it's going to be very nice to have extra information about how a location stacks up. Obviously, our reviewers will be more into the beer experience and our reviews will have a much more focused aim. But there's so many reviews on google's system that it will only flesh out the experience over here to have that information easily available.
Google scores reviews on a 1 to 5 based system. Ours are on a 1 to 100 based system. This should help differentiate our review scores against Google's at a quick glance.
Google review scores will appear in the information bubbles on map views (the styling of this presentation may change).
And you can also find the scores matched up beside our Beer Mapping Scores on a location detail page.
Hopefully these updates will help people find more beer with less work. If you have ideas or suggestions, please post them below in the comments. Read on if you want to know the nerdy details about how we're getting this information.
The Nerdy Part
When you're working with a database like ours, there are a few issues with syncing up your location information with another website's location information.
First, there's the problem with the names being different. When you're trying to match one location up to another location by name conflicting issues will happen. Sometimes a location will have an ampersand instead of an "and" in the name. Sometimes the location name will spell out Company and sometimes it will just say Co. Occasionally the name will have "Pub and Grill" in the title and the other database may have left this part off. These issues are easy for you and me to look at and see the differences, but it's not as easy to tell a computer to do it programatically.
Second, there's an issue with locations being in slightly different spots. Some locations in our database date back ten years. Google has changed how they geocordinate locations and some of our older locations that haven't been adjusted, could easily be fifty or even a hundred meters away from where Google thinks they are.
The way we have tackled these two main issues was helped greatly with the Google Places API queries. We find a location in the Beer Mapping Project database and we do a Nearby Search at 100 meters. We're searching at such a broad distance, to make sure if there are mistakes in our database we can still find any similar location in Google's database. We also specify a location type like "bar" or "liquor_store" or "restaurant." Google then sends back a list of locations of those types within that 200 meter wide circle.
Now that we have a list, we take the name of the location from Beer Mapping's database and we use a php similar_text function and if the two names have a calculation of 50% or higher, we accept this as a match.
Once we have a match, we can now query Google Places for a bit more information about this location. Reviews, scores, photos and open hours are several of the items that are available to us for each location. Our goal is to set up a process where we scan each location in our database once weekly to keep operating hours and review scores updated.
Thus far, we've only scanned United States locations and using this system we've captured data for more than half of them. It'll be a slow process, but there are ways for us to tweak our system so that we'll have even more data from Google Places available matched up to our database. We plan to start testing in other countries very soon.
As always, please post below if you have ideas, concerns or just a general interest in seeing your written words on a computer screen. We will probably read what you have to say.