javascript - google place search location biasing -
i using google places search , want "location biasing" on gcc countries (uae, saudi arabia, oman, kuwait & bahrain).
i want achieve below https://developers.google.com/maps/documentation/places/autocomplete#location_biasing
i want provide google places search on textbox user can see results these countries uae, saudi arabia, oman, kuwait & bahrain?
thanks,
i can "location bias" on 1 country using "componentrestrictions" argument shown in below code snippet
var mapoptions = { //bounds : defaultbounds, center: new google.maps.latlng(25.2644444, 55.31166669999993), zoom: 13, maptypeid: google.maps.maptypeid.roadmap }; map = new google.maps.map(document.getelementbyid('map_canvas'), mapoptions); var input = document.getelementbyid('searchtextfield'); var inputoptions = { types: ['(cities)'], **componentrestrictions: { country: 'ae' } // want multiple counteries here** }; var autocomplete = new google.maps.places.autocomplete(input, inputoptions); but want location biasing on multiple counteries mention above.
as of january 2017 can create filter multiple countries in place autocomplete.
you can restrict autocomplete predictions surface multiple countries. can specifying 5 countries in componentrestrictions field of autocompleteoptions.
https://developers.google.com/maps/documentation/javascript/releases
https://developers.google.com/maps/documentation/javascript/3.exp/reference#componentrestrictions
Comments
Post a Comment