Mano Marks, Senior Developer Advocate
Mano Marks, Senior Developer Advocate


Context...
...
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... 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...
Request Types
"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/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"
},
{ ...
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"
}
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"
}
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"
}
POST https://maps.googleapis.com/maps/api/place/check-in/json?key=...
{
"reference": "AAA..."
"event_id": "BBB..."
}
Google Places API available as both a Google Maps API Library and a Web Service
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
Google Geo APIs
http://goo.gl/EOBMh
Google Geo Developers Blog
http://goo.gl/NYbrP
Twitter
@GoogleMapsAPI
Google Plus:
http://profiles.google.com/mano.marks
Twitter:
@ManoMarks