Monday, July 11, 2011

Geo APIs Summer Learning Series: Google Places API

Google has one of the world’s most comprehensive databases of Places information, including over 50M business listings and points of interest worldwide. The Google Places API lets your applications tap into that database, to find the Places your app needs, so that users can indicate the Place they are at, or discover new Places nearby.

Following the introduction of the Places API at Google I/O last year, we worked with developers in a limited preview to understand what was needed to ensure the Places API is as powerful and easy to use as possible. In the “Connecting People with Places” session at this year’s I/O I was very happy to announce that having implemented the feedback we received during the preview, the API is now accessible to all:

The Places API is provided in two ways, a set of XML and JSON web services, and a set of corresponding classes in the Maps API v3.

The web services are ideal for mobile app developers, and can be queried from the developer’s own infrastructure, or directly from the app running on the smartphone. The Places API Search service focuses on location-based search, delivering up 20 Places in the vicinity of a user’s location. Search results can be filtered by Place name, or by one of over 90 categories, such as ‘restaurant’, ‘night_club’ or ‘spa’. The Places API Autocomplete service focuses on text based search, providing autocompletions of Places near the user as they type.

The Places API Report services also allows apps to submit new Places provided by users, which are instantly added to subsequent search results, and also delete them at a later date if required. Apps that allow users to identify the Place they are in at the time can also pass this “check-in” signal back to the Places API Check-in service which factors this real time popularity signal into the ranking of subsequent searches, so that the Places popular with users of the app are ranked higher in real time.

The Engineering Lead for the Places API, Marcelo Camelo, dove into how to get started with the Places API web services, and the structure of requests and responses in the “Location Based App Development using Google APIs” session:

For web based applications the Places API has also been integrated into the JavaScript Maps API v3. The PlacesService class provides access to Places API Search directly from the web based Maps applications, while the Autocomplete class enables a HTML text field to predict autocompletions of Places as the user types:

To use the Places API classes in your Maps API applications you simply need to request the new places library when you load the API into your web page. To use the web services, you must first create a new project in the Google APIs Console, and then enable the Places API on that project. You can then use the APIs Console key for that Project to access the Places API.

Initially your key will offer courtesy quota of 1,000 requests per day. Once you are ready to launch the next great location based app, simply “Enable billing” on the project. You will be prompted to provide credit card details, in order to verify your identity. Once you have done so, your quota will increase to 100,000 requests per day, but the API will remain free to use. Note that you may be charged if you use the same key for other APIs, which you can avoid by creating a separate project for accessing other APIs.

For more information on how to use the Places API, check out the documentation for the Search and Autocomplete web services and Maps API v3 places library. You can also discuss the API with other developers on the Google Maps API Web Services forum, and request additional features you would like to see the API offer, or report any problems you find, using the Places API section of the Google Maps API Issue Tracker.

Our launch at Google I/O this year was just the beginning of the Google Places API story. We are looking forward to bringing you many more features in the future to help you build more innovative and compelling location based applications. So do get started developing your apps, but keep an eye on this blog for more to come!