Mano Marks, Senior Developer Advocate

Finding Your Place in the World: Google Places API

#gddde

Google Geo APIs

What is a Place?

Why Are Places Important

Context...

Google Places

Google Places API

What is the Google Places API?

Features of the Google Places API

Google Places API: Two methods of access

Google Maps API: Places Library

Switch to V3!

Search for nearby places

  ...
  request = {
    location: mapCenter,
    radius: '1000',
    types: ['university']
  };
  service = new google.maps.places.PlacesService(map);
  service.search(request, callback);
  google.maps.event.addListener(map, 'click', function(event){
    clickLocation = event.latLng;
      request = {location: clickLocation,radius: '1000',
                 types: ['university']
                 };
      service.search(request,callback);
    });
  }
  ...
function callback(results, status) {
  ...add markers to map...

Places Library: Autocomplete

Autocomplete Code

  autocomplete =
  new google.maps.places.Autocomplete(
    document.getElementById('autocomplete')
  );
  google.maps.event.addListener(
    autocomplete,
    'place_changed',
    function() {
      showSelectedPlace();
  });

  function showSelectedPlace() {
  ...add markers for place returned...

Web Services: Places API

One of Several APIs

Web Services: Places API

Request Types

Place Search & Details

  "results": [ {
  "name": "Zaaffran Restaurant - BBQ and GRILL, Darling Harbour",
  "vicinity": "Darling Drive, Darling Harbour, Sydney",
  "types": [ "restaurant", "food", "establishment" ],
  "geometry": {
      "location": {
          "lat": -33.8712950,
          "lng": 151.1984770
      }
  }, ...

Place Keyword Search - new!

place/search/json?location=-33.8,151.2&radius=5000&
      keyword=costume&sensor=false&key=...
{
   "html_attributions" : [
      "Listings by \u003ca href=\"http://www.yellowpages.com.au/\"\u003eYellow Pages\u003c/a\u003e"
   ],
   "results" : [
      {
         "geometry" : {
            "location" : {
               "lat" : -33.886440,
               "lng" : 151.209780
            }
         },
         "icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
         "id" : "40356841572f45c31fe8ad1ce5e11eb7b6cf9ab7",
         "name" : "Snog The Frog-Fancy Dress & Costume Hire",
         "rating" : 2.60,
         "reference" : "CoQBfwAAAFkzKbYSgK_G27kbPvf0gXkdQET...",
         "types" : [ "establishment" ],
         "vicinity" : "8/10 Hart Street, Surry Hills"
      },
      { ... 

Check-ins

Check-in Code

POST https://maps.googleapis.com/maps/api/place/check-in/json?sensor=true_or_false&key=api_key HTTP/1.1

{
    "reference": "place_reference"
}
POST https://maps.googleapis.com/maps/api/place/check-in/json?sensor=true&key=AIzaSyAiFpFd85eMtfbvmVNEYuNds5TEF9FjIPI HTTP/1.1

{
    "reference": "CmRRAAAATpOheNdDJDp5cdz1EGLqiGWhdrUnsyvn5plkWb6IbydAdnExNaDAdXBxRjhaFINDJU1UvLkVU5ZTFmUDsIDRrUCm-9Q7XLu6vi-bspAju4GG2XzRhv9ZBy9yJbK2PJVOEhD3QlprissY-rI0w3Ego93jGhSy7x8zDUYSrovufH1OxUGkcbjHBg"
}

Place Reports

Add Place Code

POST https://maps.googleapis.com/maps/api/place/add/json?sensor=true_or_false&key=api_key HTTP/1.1
 
{
  "location": {
    "lat": -33.8669710,
    "lng": 151.1958750
  },
  "accuracy": 50,
  "name": "Google Shoes!",
  "types": ["store"],
  "language": "en-US"
}

Events - New!

Add an Event

POST https://maps.googleapis.com/maps/api/place/event/add/json?key=...
{
    "reference": "AAA...",
    "summary": "Google Halloween Party!",
    "duration_ms": 28800000,
    "status": "OK"
}
{
    "event_id": "AAA....",
    "status": "OK"
}

Event Check-in

POST https://maps.googleapis.com/maps/api/place/check-in/json?key=...
{
    "reference": "AAA..."
    "event_id": "BBB..."
}

In Summary

Google Places API available as both a Google Maps API Library and a Web Service

Get Started Today

Documentation
Places API Web Services:
http://goo.gl/sGWyz

Google Maps API Places Library:
http://goo.gl/0UXCO

Google APIs Console
http://goo.gl/znxeA

Thank you!

Google Geo APIs
http://goo.gl/EOBMh

Google Geo Developers Blog
http://goo.gl/NYbrP

Twitter
@GoogleMapsAPI


Follow Mano

Google Plus: http://profiles.google.com/mano.marks

Twitter: @ManoMarks