The Google Places API is a web service that returns yelp-like information (ratings, reviews, contact info) based on your location. Using the HTML5 geolocation API described in my last post, I’ll go over how I made a simple little app that lets you view details for places near you.
Getting a Map Near You
First, include the maps API and the places API:
Using the coordinates from the geolocation API (described here), construct a map as follows:
Getting Local Points of Interest
Now that we have a map, we can integrate the Google Places API and build a localized search. The following will get up to 20 results within 5 km of the maps center point (paging is ignored for this example).
Plotting the Result List
To plot the result list from above, I wrote the following function to drop marker overlays.
Show Additional Details for each Place
The Google Places API can be used to fetch information like contact info, ratings, and reviews. Here’s some code to overlay some of this info when a marker is clicked.