因此,为了查找可以使用Google Places API的地方,您可以使用这样的API
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&types=food&name=harbour&sensor=false&key=AddYourOwnKeyHere
或者您可以使用google.maps对象中的功能,如此
service = new google.maps.places.PlacesService(this.gmap);
var that = this;
if ( data.search.length <= 0 ) {
request['types'] = data.types;
service.nearbySearch(request, function(results, status) {
that.markPlaces(results, status);
that.gmap.setZoom(14);
});
} else {
request['query'] = data.search;
service.textSearch(request, function(results, status) {
that.markPlaces(results, status);
that.gmap.setZoom(14);
});
}
我想知道google.maps
对象中是否有内置对象使用而不是API,就像Places服务
https://maps.googleapis.com/maps/api/timezone/json?location=39.6034810,-119.6822510×tamp=1331161200&key=API_KEY
我问的原因是因为IE8让我很难用ajax请求(跨域)而且我不想依赖IE8中内置的XDomain对象