Google Map API to find nearby restaurant around my place

Viewed 20402

I am working on Google map api [Here is my to find out near by restaurant. . . When I run this, I get only current location. I am not receiving any information related to restaurant data.

<script>

      function initMap() {
          var map = new google.maps.Map(document.getElementById('map'), {
              center: { lat: 25.276987, lng: 55.296249 },
              zoom: 15
          });

          var infoWindow = new google.maps.InfoWindow({ map: map });

          if (navigator.geolocation) {
              navigator.geolocation.getCurrentPosition(function (position) {

                  var pos = {
                      lat: position.coords.latitude,
                      lng: position.coords.longitude     
                  };
                  infoWindow.setPosition(pos);
                  infoWindow.setContent('Location found.');
                  map.setCenter(pos);
                  var marker = new google.maps.Marker({
                      map: map,
                      position: pos.getPlace().location
                  });
                  var service = new google.maps.places.PlacesService(map);
                  service.nearbySearch({
                      location: rak,
                      radius: 5500,
                      type: ['restaurant'] // not resturant
                  }, callback);

              }, function () {
                  handleLocationError(true, infoWindow, map.getCenter());
              });
          }
          else {            
              handleLocationError(false, infoWindow, map.getCenter());
          }
      }
1 Answers
Related