Yes. Places API requests have component=country (Place Autocomplete) or region (Place Search, Place Details) parameters to influence the results to a specific country. These parameters take in a ccTLD (country code top-level domain) code which follows the ISO 3166-1 Alpha-2 standard so in the requests, countries need to be specified in its corresponding two-character code value. For example (value can be specified in all caps):
- us: United States
- gb: United Kingdom of Great Britain
- jp: Japan
- pr: Puerto Rico
- za: South Africa
Usage in Places API requests:
Place Autocomplete component=country parameter usage:
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Versailles&components=country:fr&key=<YOUR_API_KEY>
Place Details region parameter usage:
https://maps.googleapis.com/maps/api/place/details/json?place_id=ChIJDbg7ZMt95kcR_38nIKnyHmM&fields=name®ion=fr&key=<YOUR_API_KEY>
Important: Before using any country code, please check if Google Maps Platform has coverage to its corresponding country. You can refer to Where can I check if a country has Google Maps Platform coverage? to get this information.
Comments
0 comments
Please sign in to leave a comment.