Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Places API gives one result for correct spelling and all results for incorrect spelling

We use google places API to pull local data.

For a particular query - Saint Louis Renters Insurance we get only one result as shown in the image below :

One result for 'Saint Louis Renters Insurance' query

But when the same query is spelled incorrectly Siant Louis Renters Insurance [spelling mistake in the word 'Saint'] , we get all the results as shown in the image below :

Many results for 'Siant Louis Renters Insurance' query

Could anyone tell me whats happening here? I posted this question in the Google Places API group but some how my post got deleted, as you can see in the below image, which is pretty annoying :

enter image description here

It would be real bad if google places api starts giving less results for correct querys.

like image 261
VishwaKumar Avatar asked Nov 02 '22 09:11

VishwaKumar


1 Answers

The Places API always returns the best results it can, so if you're filtering by text or exact keywords and there's a good string match, it will return only that. Multiple results are only returned if it's not confident enough about correctness.

If you simply want to return a list of all possible insurance agencies in St Louis, try a Nearby Search with a latlng in St Louis, a suitable radius (10 km below) and a types=insurance_agency filter:

http://maps.googleapis.com/maps/api/place/nearbysearch/json?types=insurance_agency&sensor=false&location=38.597051,-90.217889&radius=10000&skip_auth

like image 64
lambshaanxy Avatar answered Nov 08 '22 06:11

lambshaanxy