如何使用谷歌地图找到附近的沙龙

时间:2013-07-20 21:23:31

标签: google-maps google-places-api

我看到很多应用程序,我们可以找到附近当前位置,咖啡馆,历史名胜的酒店。我的问题是这些应用程序如何工作。我想使用谷歌地图找到我所在位置附近的所有沙龙。

提前致谢

1 个答案:

答案 0 :(得分:2)

对于SO而言,这不是一个真正的问题。

你应该在这里分享一些代码。

从技术上讲,应用程序正在访问您的设备以获取您的实际位置。该位置将发送到Google服务以获取附近的场地。

以下是您要查找的API文档:

https://developers.google.com/places/documentation/search#PlaceSearchRequests

距离该位置500米范围内的酒店+咖啡馆的JSON请求示例如下:

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&types=lodging|cafe&sensor=false&key=

答案:

{
   "debug_info" : [],
   "html_attributions" : [
      "Listings by \u003ca href=\"http://www.yellowpages.com.au/\"\u003eYellow Pages\u003c/a\u003e"
   ],
   "next_page_token" : "CmRWAAAAsUEgntucrrrrrztccccccccccccccccctrutiuztiztbiuztuizbtiutiuztbiuiuviuzviuzvtiuzvtiuztzt",
   "results" : [
      {
         "geometry" : {
            "location" : {
               "lat" : -33.8682320,
               "lng" : 151.1944780
            }
         },
         "icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/lodging-71.png",
         "id" : "44fdc977984610cd873c790a7d850e8185ed0e5e",
         "name" : "The Star",
         "opening_hours" : {
            "open_now" : true
         },
         "photos" : [
            {
               "height" : 645,
               "html_attributions" : [],
               "photo_reference" : "CnRnAAAAiPbYRZyb3g2U24OseZ_SY8QsqV6_f7nTvTafCMjNx_ND8XAVSu9GRzlVuC6_vgpNLvla_15CwobVJ8OQ28cErzsRJoEv9oLcGUC0OgjckITJsV8KpFVqMJDckK_6YFVYl338abMILn1WhNelkAqf8RIQ2b2Ce5Iuj8b1r0RRRSl-fxoU5ukXpkS4l2tLXk0ww4AIO1DcPTU",
               "width" : 1024
            }
         ],
         "rating" : 4.10,
         "reference" : "CnRlAAAA0DFDJkHyQzlm5FYgwa2LMPqFJ8shLUy8eDuzTL_EJUYywpxhfM1u0tZrs1v2qEm7_jBhLkO6bTZ-9C2DGetrRXddXOOuOpu0_iX3aejDZA4LtnhjnbSsY1dUCKrz4TopBl4C_N0jo-psa8gqpjk7YBIQCITjeps5I49ktTl0YdcmORoUQOEpyEx83-3C31WQhaO244HIKtY",
         "types" : [ "lodging", "casino", "establishment" ],
         "vicinity" : "80 Pyrmont Street, Pyrmont"
      },
      {
         "geometry" : {
            "location" : {
               "lat" : -33.8711760,
               "lng" : 151.1977440
            }
         },
         "icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/lodging-71.png",
         "id" : "64725a86605e7682a694c5383338e95b8993b398",
         "name" : "Ibis Sydney Darling Harbour",
         "photos" : [
            {
               "height" : 512,
               "html_attributions" : [],
               "photo_reference" : "CnRpAAAArVHuwn2GgRDxrOCgsD4GFElM6FqS-A0-u73Qu0Nj0oOx0owIchJ0PCrbioL6_69iS_ySkMSXf9mh0lWCrZ4WhuFCd8sEuaXoYTxgnvEcPAOAVrqJh7o1a7P7CYUJokTYYVJsBM4lkqwahLnfSmUHexIQTTSmg_rTSG6IZyQIRvxaFBoU_9xy_-UEolJkP84XmpCJXBd9uu8",
               "width" : 768
            }
         ],
         "rating" : 2.50,
         "reference" : "CoQBeQAAADAz-pJrKjgSXfk_6Ob_MgkKhgLFEnDgP8uzr3xD0Dd5-uoOMIWz6nb8LqZClFMkliJWWabGrGVrTt2W2iSpMUCfjisk-PXFPp8wGHF-9UwCZLYUgajlgbaDksAgPpv3MpK_rOGXkDCHhGZR2nDmVjYR-O6DzAqlgxdQjSyMnKZzEhDA-WdS63oMMHyMketIdRQzGhQLhebOlBk_1kaVbuoKrZJ0OVOzDA",
         "types" : [ "lodging", "establishment" ],
         "vicinity" : "70 Murray Street, Pyrmont"
      },
      {
         "geometry" : {
            "location" : {
               "lat" : -33.8682560,
               "lng" : 151.19470
            }
         },
         "icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/lodging-71.png",
         "id" : "8d3d1de1853d3f71bde4abce55f34d8b08bc0778",
         "name" : "The Darling",
         "photos" : [
            {
               "height" : 1632,
               "html_attributions" : [ "From a Google User" ],
               "photo_reference" : "CnRoAAAA3PhdRqh3hanXgxS7dPztPzHA0KaHQaF5fzKoL6ZGY70E_ylX9Weg-WSVG2q3aZIN_qakszBSlLXJf7PDkNni2n03q0n1Nny2IUKz299JCLyOawkoXNVNi2iiXMnibGQ9mG43fNpdICFcWjH2qfXANRIQZ4Z9COimQVjrr1dWG-20_RoUZ9FopmujWWO4aUeWE-oFOnjz9HQ",
               "width" : 920
            }
         ],
         "reference" : "CnRoAAAA_1MR3bAPwizOqNXQmdMZBI2ES9wEG7RljLZy27FX4Hrc1OY_7u6MtGhYHJnFHoMxxTVI2gN-DgMuFvvIiR6iRbMFP0yq-xQpVEpBAXsWFjI_PkmxSHvr24nk0TRVgx2o7deAtQ7vNanSm26-xjrHZhIQC97he353JJ9Kj8DIhArcLBoUbJj58dqAdM5_RCJI_FW_1KmZCmg",
         "types" : [ "lodging", "establishment" ],
         "vicinity" : "80 Pyrmont Street, Pyrmont"
      },  

以下是您可以查找的不同场地类型:

https://developers.google.com/places/documentation/supported_types