javascript - Google maps only show search results in the US -


i'm using angular google maps api. problem when geolocation turned off , use search box search generic, not address-bound things or stores "pizza" or "ikea" map shows results in default.

i want able choose own default location use when geolocation turned off. i'm not sure how this.

this code

  //search features  $scope.searchopen = false; $scope.searchmodel = {}   //add , remove css classes on search bar show , hide searchbar   $scope.togglesearch = function () {      $scope.searchmodel.searchterm = null;       var searchfieldinput = document.getelementbyid('pac-input')      if (searchfieldinput.classlist.contains('searchactive')) {         searchfieldinput.classlist.remove('searchactive')         searchfieldinput.classlist.remove('pac-container')       } else {         searchfieldinput.classlist.add('searchactive')     }    }  $scope.$watch("searchmodel.searchterm", function (searchtext) {     $scope.filteredmarkers = $filter("filter")($scope.specialmarker, searchtext);     if (!$scope.filteredmarkers) {         return;     } });   $scope.searchbox = {     template: 'searchbox.tpl.html',     position: 'top-left',     options: {         bounds: {}     },     events: {         places_changed: function (searchbox) {             $scope.repositionallowed = false;              places = searchbox.getplaces()              if (places.length == 0) {                 return;             }             // each place, icon, place name, , location.             newmarkers = [];             var bounds = new google.maps.latlngbounds();             (var = 0, place; place = places[i]; i++) {                  // create marker each place.                 console.log(place.place_id)                  var marker = $scope.createmarker({                     id: 's' + i,                     title: place.name,                                         address: place.formatted_address,                      lat: place.geometry.location.lat(),                     lng: place.geometry.location.lng(),                     place: place,                     pointtype: "search"                 })                  newmarkers.push(marker);                  bounds.extend(place.geometry.location);             }              $scope.map.bounds = {                 northeast: {                     latitude: bounds.getnortheast().lat(),                     longitude: bounds.getnortheast().lng()                 },                 southwest: {                     latitude: bounds.getsouthwest().lat(),                     longitude: bounds.getsouthwest().lng()                 }             }              $scope.map.zoom = 13;             $scope.map.markers = newmarkers;              document.getelementbyid("pac-input").blur();                 }     } }           $scope.defaultbounds = new google.maps.latlngbounds(         new google.maps.latlng(37.9839, 22.7294),         new google.maps.latlng(38.9839, 24.31715));       $scope.map.bounds = {         northeast: {             latitude: $scope.defaultbounds.getnortheast().lat(),             longitude: $scope.defaultbounds.getnortheast().lng()         },         southwest: {             latitude: $scope.defaultbounds.getsouthwest().lat(),             longitude: -$scope.defaultbounds.getsouthwest().lng()          }     }     $scope.searchbox.options.bounds = new google.maps.latlngbounds($scope.defaultbounds.getnortheast(), $scope.defaultbounds.getsouthwest()); }); 

thanks


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -