limiting google maps autocomplete to UK address only

后端 未结 7 1905
暗喜
暗喜 2020-12-18 21:14

I\'ve been looking at the example on:

http://code.google.com/apis/maps/documentation/javascript/examples/places-autocomplete.html

and have decided to incor

7条回答
  •  南方客
    南方客 (楼主)
    2020-12-18 21:50

    James Alday is correct:

    http://code.google.com/apis/maps/documentation/javascript/places.html#places_autocomplete

    var defaultBounds = new google.maps.LatLngBounds(
      new google.maps.LatLng(49.00, -13.00),
      new google.maps.LatLng(60.00, 3.00));
    
    var acOptions = {
      bounds: defaultBounds,
      types: ['geocode']
    };
    

    it is somewhat annoying as searching for Durham gives Durham, North Carolina as the second result, regardless of how you try to persuade it to region bias - you can set it to viewport map bounds and it'll still try to suggest NC state... The jQuery solution can be found here, but doesn't seem to give as many results as the v3 API. http://code.google.com/p/geo-autocomplete/

提交回复
热议问题