我希望将 Google Places 搜索结果限制在我的用户当前位置周围 20 英里的范围内。
将半径参数添加到查询根本不起作用。这是我的代码:
query={{
// available options: https://developers.google.com/places/web-service/autocomplete
key: 'AIzaSyCMFiyTGVGJQgi1AOShIuRppi9JqcSgobw',
language: 'en', // language of the results
types: ['street_address', 'establishment'], // default: 'geocode'
components: 'country:us'
latitude: 32.795969,
longitude: -80.028863,
radius: 100
}}
styles={locationAutocompleteStyle}
currentLocation={false} // Will add a 'Current location' button at the top of the predefined places list
currentLocationLabel="Current location"
nearbyPlacesAPI="GooglePlacesSearch" // Which API to use: GoogleReverseGeocoding or GooglePlacesSearch
GoogleReverseGeocodingQuery={{
// available options for GoogleReverseGeocoding API : https://developers.google.com/maps/documentation/geocoding/intro
}}
GooglePlacesSearchQuery={{
// available options for GooglePlacesSearch API : https://developers.google.com/places/web-service/search
// rankby: 'distance',
}}