0

I am developing a functionality where in I am using google places API.Code is working fine and at times I get results and at times I do not.Not sure as why this is happening.Few queries for which I need some clarification are,

  1. I have a drop down where I give the distance as 1 mile and 3 mile and then trigger the google places api.I am taking type as bank.Now when I search within the radius of 1 mile, I get 10 results and when I search with the same type for 3 miles radius, I get 5 results. Actually I was thinking I should have total of 15 results for 3 mile search.But this is not happening ? Am I missing to read something here ?

  2. I am doing geocoding on the client side, what options do you suggest to cache the lat and lng.I read in google maps Api , that we can cache the geocoding results,can someone tell me how long we can keep this ? can we add ajax call and keep this information in DB or I need to do local storage.My site is going to be public facing, though I dont hope that I will be having more than couple of hundreds of hit a day,but still I need some way to be ready in case I might have to.

$("#id-btn").click(function( event ) {

 var type = $('#type').val();
 console.log(type)
 var radius = $('#radius').val();
 console.log(radius)
 console.log(latlng)

 var request = {
        location:latlng,
        radius: radius,
        types: [type]
    };
    console.log(request)
      service = new google.maps.places.PlacesService(map);
     console.log(service)
                      service.nearbySearch(request,createMarkers);
                    //service.textSearch(request,createMarkers);                        
                });
4

0 回答 0