I'm working on Google Place API with Text Search Requests and I'm wondering how to filter results for a specific country. Is there a way?
What I'm trying to do is call the api with results filtered by country and then manage the json result with php.
So, this is a kind of query
https://maps.googleapis.com/maps/api/place/textsearch/json?query=pizza&sensor=true&key=mykey
I wish to add a parameter like &country=us, but it seems it doesn't exists.
Thanks
Once you've made an account and are on the Google Cloud platform, you'll want to go to use the drop down navigation in the top left and choose API & Services > Credentials. Once there, you'll want to hit Create Credentials on the top followed by API key.
You can restrict results from a Place Autocomplete request to be of a certain type by passing the types parameter. This parameter specifies a type or a type collection, as listed in Place Types. If nothing is specified, all types are returned.
Google maps platform provide parameter region for next search types :
So, enjoy your pizza in United Arab Emirates: https://maps.googleapis.com/maps/api/place/textsearch/json?query=pizza®ion=ae&key=mykey
Please pay attention that this "region" parameter should be from: country top-level domains.
Most ccTLD codes are identical to ISO 3166-1 codes, with some notable exceptions
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With