本文介绍了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);


推荐答案

请参阅。

如果您认为这将是一项有用的功能,请添加。

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

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

07-12 20:30