Google Places API Radar Search avatar

Google Places API Radar Search

Try for free

No credit card required

Go to Store
Google Places API Radar Search

Google Places API Radar Search

danielmilevski9/google-maps-radar-search
Try for free

No credit card required

Get all places (more than 60 results) inside the search radius at latitude-longitude from the Google Places API.

Features

Official Google Places API Nearby search can return as many as 60 results, split across three pages. Actor overrides this limit and gets all places in a few kilometers radius around specified geopoint by doing distance search. Idea behind is to avoid anti-pattern as displayed below, since it leads to twice more API calls in order to get each additional 10% of results:

Instead (all further math references for 1Km search radius with 50 meters grid radius) we can:
  • Create a grid from 2 x 2 km area with 100 x 100 m cells (from radius of 1000 and 50 meters)
  • Based on inner margin we have 380 cells in bounding box or 312 cells inside the search circle
  • Still, for high populated areas we can hit 60 places limit for a few cells
  • If so, we add new 8 search points at half of cell radius around such cells
From a higher perspective even for Central Europe or USA we can find the best possible cell radius for given search distance and coordinates which will give us 99% of accuracy with minimal amount of API calls. Density of places will not be changed rapidly in days or months, so the right combination for each search will allow a rescan area to find new places and keep lowest running costs.

External requirements

You need to obtain your own Google API key

Proxy

Google API might block proxy access (not expected, rare issue), if-when happens actor will show error [BAD-REQUEST]

Cost of usage

  • Google rates applied as usual: 32.00 USD per 1000 calls, 1km radius covered by approx 400 API calls, therefore each run for 1km radius in populated area should save approx $10-20 on Google API charges.

Input example

Search radius set to 1000 meters and grid radius set to 50 meters by default.

1{
2  "apiKey": "YOUR OWN GOOGLE API KEY",
3  "latitude": "47.41168232410833",
4  "longitude": "8.54417797274538",
5  "radiusMeters": 1000
6}

Output example

Output saved exactly as it comes from Google API data feed with calculated distanceMeters (from search center) added to it.

1{
2  "distanceMeters": 920,
3  "business_status": "OPERATIONAL",
4  "geometry": {
5    "location": {
6      "lat": 47.4036189,
7      "lng": 8.5419602
8    },
9    "viewport": {
10      "northeast": {
11        "lat": 47.4049176302915,
12        "lng": 8.543189430291502
13      },
14      "southwest": {
15        "lat": 47.4022196697085,
16        "lng": 8.540491469708497
17      }
18    }
19  },
20  "icon": "https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/generic_business-71.png",
21  "icon_background_color": "#7B9EB0",
22  "icon_mask_base_uri": "https://maps.gstatic.com/mapfiles/place_api/icons/v2/generic_pinlet",
23  "name": "Dr. phil. Würth Josy",
24  "place_id": "ChIJ2z-n_44LkEcRWdpWOIwcZ1Q",
25  "plus_code": {
26    "compound_code": "CG3R+CQ Zürich, Switzerland",
27    "global_code": "8FVCCG3R+CQ"
28  },
29  "reference": "ChIJ2z-n_44LkEcRWdpWOIwcZ1Q",
30  "scope": "GOOGLE",
31  "types": [
32    "doctor",
33    "health",
34    "point_of_interest",
35    "establishment"
36  ],
37  "vicinity": "Ringstrasse 50, Zürich"
38}

Dev notes

You can clone actor and create your own build in Apify cloud with ENV.apiKey or ENV.APIKEY to exclude your Google API key from input (for example to provide support for doing secure runs from mobile or desktop apps).

Developer
Maintained by Community

Actor Metrics

  • 4 monthly users

  • 4 stars

  • >99% runs succeeded

  • Created in Jun 2022

  • Modified 6 months ago

Categories