Google Places API - getQueryPredictions按国家/城市/州限制? [英] Google Places API - getQueryPredictions Restrict by Country/City/State?

查看:190
本文介绍了Google Places API - getQueryPredictions按国家/城市/州限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是google给出的getQueryPredictions示例

Below is the getQueryPredictions example given by google

service.getQueryPredictions({input: 'pizza near'}, callback);

有没有办法限制特定国家/城市/州的结果?

Is there a way to restrict results for a specific country/city/state?

另一个函数/组件有能力做到这一点

The other function/component has ability to do this

var input = document.getElementById('searchTextField');
var options = {  types: ['(cities)'],  componentRestrictions: {country: 'fr'}};
autocomplete = new google.maps.places.Autocomplete(input, options);


推荐答案

请参阅参考文档

如果您认为这将是一项有用的功能,请添加 Places API - 功能请求

If you think this would be a useful feature please add a Places API - Feature Request.

这篇关于Google Places API - getQueryPredictions按国家/城市/州限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆