Open imgregduh opened 7 years ago
I didnt work on that part specifically so you're definitely helping here.
Are there any other possible APIs that can utilize that NextPageToken ? I ask so we can plan on how to utilize that by declaring in a base class that the particular api response types (plus perhaps an interface) can use for consistency
On Sun, Nov 20, 2016 at 2:50 AM, ImGregoryWong notifications@github.com wrote:
public List<PlacesResult> GetNearbyPlaces(LatLng coords) { var nearByrequest = new NearbySearchRequest { Radius = 500, Location = new LatLng(coords.Latitude, coords.Longitude), Sensor = false, Types = new PlaceType[] { PlaceType.Restaurant } }; var results = new List<PlacesResult>(); GetPlaceResponses(nearByrequest, results); return results; } private void GetPlaceResponses(NearbySearchRequest nearByrequest, List<PlacesResult> results) { var nearByresponse = new PlacesService().GetResponse(nearByrequest); results.AddRange(nearByresponse.Results.ToList()); var token = nearByresponse.NextPageToken; nearByrequest.PageToken = token; if (!string.IsNullOrEmpty(token)) { GetPlaceResponses(nearByrequest, results); } }
I am using the code above to get all the results from the nearbysearchrequest. i.e. get all 60 results.
When I let ir run by itself I only get 20 results. When I debug into it and slowly do it i get more than 20 sometimes. I have added NextPageToken to the PlacesResponse class so that the next_page_token is included in the response for that you will be able to get the next set of results.
Was there any other way to get all the results from nearbysearch or is that still undevelopment?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ericnewton76/gmaps-api-net/issues/62, or mute the thread https://github.com/notifications/unsubscribe-auth/ACG_zJNk-jxM42cxu6Uiv-OP6GW81R1iks5q__vMgaJpZM4K3eoa .
My guess is the google rate limiter, when not using an API key, i think you can only send about 3 requests/sec
I dont believe we have a good way to detect the rate limiter situation and perhaps auto-retry.
This issue will be potentially solved with Issue #39
I am using the code above to get all the results from the nearbysearchrequest. i.e. get all 60 results.
When I let it run by itself I only get 20 results. When I debug into it and slowly do it i get more than 20 sometimes. I have added
NextPageToken
to thePlacesResponse
class so that thenext_page_token
is included in the response for that you will be able to get the next set of results.Was there any other way to get all the results from nearbysearch or is that still undevelopment?