Reputation: 35
I have this problem with Google Places API. I'm searching for "Guildhall" in Cambridge. It finds it exactly on maps: https://www.google.pl/maps/place/Guildhall,+Market+Hill,+Cambridge+CB2+3QJ,+Wielka+Brytania/@52.2046916,0.1193167,17z/data=!3m1!4b1!4m2!3m1!1s0x47d870bd9c1c0a5d:0x7228336bd9005dae
But places api doesn't return "Guildhall" as a result: https://maps.googleapis.com/maps/api/place/search/json?location=52.2046916,0.1193167&rankby=distance&keyword=guildhall&sensor=true&key=YOUR_API_KEY
Is it possible to return results like "Guildhall" from Places API?
Upvotes: 0
Views: 1162
Reputation: 4125
You can configure the types of places you want returned by specifying the type:
See the documentation here; https://developers.google.com/places/documentation/supported_types
Then pass in the type option when creating your service;
var request = {
location: pyrmont,
radius: '500',
types: ['store'] // specify the types here
};
service = new google.maps.places.PlacesService(map);
service.nearbySearch(request, callback);
UPDATE:
I may have a solution for you: You could try using the Geocode service from Google: https://developers.google.com/maps/documentation/javascript/examples/geocoding-simple
I have put it into a JS Fiddle for you to have a playaround with: http://jsfiddle.net/loanburger/1vhymg6m/
Hope that helps
Upvotes: 1