How do I get local business results using google maps API

放肆的年华 提交于 2020-02-21 05:00:56

问题


  1. Is there any google/Yahoo/Bing API which gives local business results based on a ZIP/GeoCode of a location? If yes, please let me know.

  2. If Google Maps has such service, please let me know what where do I get a reference regarding that?


回答1:


Google does have that, you can even check few sample implementations:
http://code.google.com/apis/ajaxsearch/local.html




回答2:


Disclosure: I work at SerpApi.


Is there any google/Yahoo/Bing API which gives local business results based on a ZIP/GeoCode of a location?

Yes, you can use SerpApi to get local business results based on ZIP, query, or GPS coordinates: https://serpapi.com/playground?engine=google_maps&q=coffee+Austin+TX+78747&type=search

Sample response

{
  "local_results": [
    {
      "position": 1,
      "title": "The Standard Grill",
      "data_id": "0x89c259c06677ef37:0x5707f22fe7137aa2",
      "gps_coordinates": {
        "latitude": 40.7406697,
        "longitude": -74.0079042
      },
      "place_id_search": "https://serpapi.com/search.json?data=%214m5%213m4%211s0x89c259c06677ef37%3A0x5707f22fe7137aa2%218m2%213d40.7406697%214d-74.0079042&engine=google_maps&google_domain=google.com&token=f01cbc346c0db944&type=place",
      "rating": 4.1,
      "reviews": 840,
      "price": "$$$",
      "type": "Bar & grill",
      "address": "848 Washington St, New York, NY 10014",
      "hours": "Open until 11:30 PM",
      "phone": "(212) 645-4100",
      "website": "http://www.thestandardgrill.com/",
      "description": "Trendy, upscale American dining. Trendy, clubby, hotel-set American bistro under the High Line with sidewalk tables & lively bar.",
      "editorial_reviews": {
        "summary": "Where To Eat On Christmas Day In New York City",
        "link": "https://www.forbes.com/sites/melissakravitz/2019/12/13/christmas-dinner-new-york-city/"
      },
      "thumbnail": "https://lh5.googleusercontent.com/p/AF1QipMGM_4u4iQcrdRZApFFIinDga-cb0rXu79aFxvv=w125-h92-k-no"
    },
    {
      "position": 2,
      "title": "Rockmeisha - Sake & Grill",
      "data_id": "0x89c259938c3a05cb:0xa1b2fe3b945a853d",
      "gps_coordinates": {
        "latitude": 40.732638,
        "longitude": -74.00237299999999
      },
      "place_id_search": "https://serpapi.com/search.json?data=%214m5%213m4%211s0x89c259938c3a05cb%3A0xa1b2fe3b945a853d%218m2%213d40.732638%214d-74.00237299999999&engine=google_maps&google_domain=google.com&token=8bcfdeb90a3d1f1a&type=place",
      "rating": 4.3,
      "reviews": 102,
      "price": "$$",
      "type": "Tapas restaurant",
      "address": "11 Barrow St, New York, NY 10014",
      "hours": "Opens at 6:00 PM",
      "phone": "(212) 675-7775",
      "website": "http://rockmeisha-izakaya.business.site/",
      "description": "Japanese drink-&-snack joint. Traditional Japanese drinking establishment pairing its sake & beer with ramen & small plates.",
      "editorial_reviews": {
        "summary": "25 Exemplary Fried Chicken Dishes Around NYC",
        "link": "https://ny.eater.com/maps/nyc-fried-chicken-best"
      },
      "thumbnail": "https://lh5.googleusercontent.com/p/AF1QipNA8eJZ-VZxHIV43490yYZCnjDbBbYUA9wiH_Lq=w122-h92-k-no"
    }
  ]
}

You can use Node.js wrapper

const { GoogleSearchResults } = require('google-search-results-nodejs')

const client = new GoogleSearchResults("API_KEY")

const parameters = {
  engine: "google_maps",
  type: "search",
  google_domain: "google.com",
  q: "NY 10014 grill",
};

function onResponse(data) {
  console.log(data.local_results[0])
}

client.json(parameters, onResponse)

If Google Maps has such service, please let me know what where do I get a reference regarding that?

https://serpapi.com/maps-local-results



来源:https://stackoverflow.com/questions/3481142/how-do-i-get-local-business-results-using-google-maps-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!