@sashavol

Реально ли убрать из автокомплита лишние места (google geocode)?

Привет.
Сделал с помощью jquery ui автокомплит с запросом через geocoder. Возвращает он то что нужно, но как ограничить отображаемые места можно? Убрать мосты, магазины и прочее, нужны только координаты, город, страна. Вижу в гайдах только ограничение по стране, но иного ограничение по другим критериям похоже что нету?
Спасибо

Код:
var geocoder = new google.maps.Geocoder();

$('#placeProfile').autocomplete({
  // This bit uses the geocoder to fetch address values

  source: function(request, response) {
    console.log(request);
    geocoder.geocode( {'address': request.term, 'componentRestrictions':{
      'country':'RU'
    }}, function(results, status) {
      response($.map(results, function(item) {
          // Get address_components
          for (var i = 0; i < item.address_components.length; i++)
          {
            var addr = item.address_components[i];
            var getCountry, getCountryShort;
            if (addr.types[0] == 'country')
              getCountry = addr.long_name;
              getCountryShort = addr.short_name;
          }
        return {
          label: item.formatted_address,
          profileCity: item.address_components[0].long_name,
          latitude: item.geometry.location.lat(),
          longitude: item.geometry.location.lng(),
          country: getCountry,
          countrySh: getCountryShort
        }
      }));
    })
  },

  // This bit is executed upon selection of an address
  select: function(event, ui) {
    // Get values
    //$('#profileCountry').val(ui.item.country);
    $('#profileCountrySh').val(ui.item.countrySh);
    $('#profileCity').val(ui.item.profileCity);
    $('#profileLat').val(ui.item.latitude );
    $('#profileLng').val(ui.item.longitude);
  }
});
  • Вопрос задан
  • 237 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы
01 мая 2024, в 02:11
5000 руб./за проект
01 мая 2024, в 00:29
2000 руб./за проект
01 мая 2024, в 00:20
15000 руб./за проект