Google Places API会返回奇怪的结果

问题描述 投票:7回答:3

我使用谷歌地方API返回有关企业的基本信息,如

- name
- address
- phone

也许图像稍晚,但即使是上面的3也会很棒。

返回的结果似乎不像我在谷歌地图中搜索时那样准确。例如,如果我在爱尔兰的阿斯隆镇搜索“花店阿斯隆”,我会得到4个结果,显然都是花店。

但是,如果我使用谷歌地方API并使用阿斯隆作为这样的坐标与花店作为关键字

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=53.4232693,-7.9490146&radius=8000&name=nail%20salon&key=x

它会返回奇怪的结果,例如购物中心,营销公司,摄影师等。现在它确实正确地返回了4个花店,但是通过地方或其他API可以返回更准确的结果。

显然,如果有人在寻找花店并且他们看到营销公司和摄影师,那么这些信息看起来很可靠。我喜欢的地方是它每天免费提供150,000次搜索。理想情况下,建议的API或方法也会有一个不错的免费计划。

这只是一个例子,但是有大量的例子适用于所有类型的业务类别,其中返回的信息不准确。我也考虑过使用类型值,但这看起来并不好。例如,你不能通过b&b你必须通过过于宽泛的住宿我需要返回特定类别,如酒吧,餐厅,b&b,屠夫等

    {
   "html_attributions" : [],
   "results" : [
      {
         "geometry" : {
            "location" : {
               "lat" : 53.4242032,
               "lng" : -7.934448300000001
            },
            "viewport" : {
               "northeast" : {
                  "lat" : 53.42555302989273,
                  "lng" : -7.933098470107277
               },
               "southwest" : {
                  "lat" : 53.42285337010728,
                  "lng" : -7.935798129892721
               }
            }
         },
         "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/shopping-71.png",
         "id" : "4e0ff98af928a212bcd64e35c25278c7a962b1e0",
         "name" : "A Room in Bloom",
         "opening_hours" : {
            "open_now" : true
         },
         "photos" : [
            {
               "height" : 2368,
               "html_attributions" : [
                  "\u003ca href=\"https://maps.google.com/maps/contrib/113110406294245292993/photos\"\u003eGary Kearney\u003c/a\u003e"
               ],
               "photo_reference" : "CmRaAAAAm5vmwNVndTiIiDiX-fGVhB-8aTx7Kyp4qMucuvcc80DMhGpn6nG0Q3DBK9_5jqT7fZDIctw-KHJ89RE_D2sJj5xr4Sy6zAYlVnyJx7VbRMqpHKY3Mr_eKmFTvnDKhP4CEhChU8nLg8ikqfsCcXukqoKGGhRVNPN5GdlO-KNWYgg3W3sLp-GiWg",
               "width" : 4208
            }
         ],
         "place_id" : "ChIJQ-Uh0wVJXEgRHwfLO-9Qe_0",
         "plus_code" : {
            "compound_code" : "C3F8+M6 Athlone, County Westmeath, Ireland",
            "global_code" : "9C5JC3F8+M6"
         },
         "rating" : 4.6,
         "reference" : "CmRbAAAAVbtKUhG5syxA1oSfs3xvlsZtRfM9CijH13Hml4lPi3xdNwN-Pvs3KJRQ5wd0ZBdFI1G5d3VaaZm0lQVqulKIBqc2DLul2X2eeDaTVQFV84X0WX9xkflqORHVsdoabZCrEhDeR78yzfbmWMpF6Mtml2QkGhRTtjvPgqdoaQNCklJy416Gb2094Q",
         "scope" : "GOOGLE",
         "types" : [ "florist", "store", "point_of_interest", "establishment" ],
         "vicinity" : "Fairview Terrace, Garden Vale, Athlone"
      },
      {
         "geometry" : {
            "location" : {
               "lat" : 53.4230177,
               "lng" : -7.949603499999998
            },
            "viewport" : {
               "northeast" : {
                  "lat" : 53.42436752989271,
                  "lng" : -7.948253670107275
               },
               "southwest" : {
                  "lat" : 53.42166787010727,
                  "lng" : -7.950953329892719
               }
            }
         },
         "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/shopping-71.png",
         "id" : "d0a8341c1a26a933c926b94227f7e185954337c8",
         "name" : "Dooley's Westend Flowers",
         "opening_hours" : {
            "open_now" : true
         },
         "photos" : [
            {
               "height" : 3024,
               "html_attributions" : [
                  "\u003ca href=\"https://maps.google.com/maps/contrib/110208982636998757346/photos\"\u003eDooley's Westend Flowers\u003c/a\u003e"
               ],
               "photo_reference" : "CmRaAAAAQEyT0e3Fi2X7GdSDWaS4NaQoPhq1WGr9KVJoqFnuRSEbGr07sEToiAtP0Jqo2IsOdpBTGY99kLThSO88D0ySco5zbVYG40vxIA-TOlgMP4nXAJKvgJPNzsRE6u05gbyeEhAKodedRy7xMHLiJ3BGu0pjGhQ7veW7qSB13wxp84JzJNhc2Y_2Jg",
               "width" : 4032
            }
         ],
         "place_id" : "ChIJ5RDhM_xIXEgRUfEQvO3MJEw",
         "plus_code" : {
            "compound_code" : "C3F2+65 Athlone, County Westmeath, Ireland",
            "global_code" : "9C5JC3F2+65"
         },
         "rating" : 4.8,
         "reference" : "CmRbAAAAeJhLEAtKzEaZ3BsoVcYdcD0mK35nmagxtMRDTkEXitI2eR_fS90rsUr65sp13YlLugzeLkC-fJQrvJfbZ9FzO0DhyjyQiifsI_SdttCNflNQoumRh0-JENcgXqWFd_wUEhDPqZJvkyl4d3HRHpa5UzNLGhQ081hZgVh0M36W2PutZOnYlsJ6Hw",
         "scope" : "GOOGLE",
         "types" : [
            "florist",
            "grocery_or_supermarket",
            "home_goods_store",
            "store",
            "food",
            "point_of_interest",
            "establishment"
         ],
         "vicinity" : "Magazine road, Athlone"
      },
      {
         "geometry" : {
            "location" : {
               "lat" : 53.4202395,
               "lng" : -7.933982299999999
            },
            "viewport" : {
               "northeast" : {
                  "lat" : 53.42158932989273,
                  "lng" : -7.932632470107277
               },
               "southwest" : {
                  "lat" : 53.41888967010728,
                  "lng" : -7.935332129892721
               }
            }
         },
         "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/shopping-71.png",
         "id" : "335dbc850f70f158aa2023c2f9d894bad2f069eb",
         "name" : "Dooley's",
         "opening_hours" : {},
         "photos" : [
            {
               "height" : 4032,
               "html_attributions" : [
                  "\u003ca href=\"https://maps.google.com/maps/contrib/111352362883151837153/photos\"\u003eMichael Carty\u003c/a\u003e"
               ],
               "photo_reference" : "CmRaAAAAor8kyir_1aeJsWXo92PDIl4gNUpql3bGKUeXlH2zo8Uq8QfkOPQS0jwQ_nhuz4UzP1crIPY0wKtajgSQPxlgugNNJW9UOKrAS8-mxghnsfnVE__sDl9ZWWLj8MhRDRKzEhDaCNN-80IOdpWEgWk6hdrAGhQ0_CrCoKsLXQTSFcc1nt5ADx0ifQ",
               "width" : 3024
            }
         ],
         "place_id" : "ChIJY-Qc2QRJXEgREay8iXABhMM",
         "plus_code" : {
            "compound_code" : "C3C8+3C Athlone, County Westmeath, Ireland",
            "global_code" : "9C5JC3C8+3C"
         },
         "rating" : 4.6,
         "reference" : "CmRbAAAAtHL-8kOfiQcsIBrN81TotZ7IcnEw72N38f7q68cz-W55e5Z-VhIF5R7ZLG9dLy3XZkzIqOZC7w4k-w4UbB5YDIP89qmR_Ety4uMjf0D8ueF_pPsLPib9S_JipDt-kS-gEhAPFiIBWm0mitDS0rdQngO_GhQfb2qa7KMqK6Y76wW8og01gjbrFA",
         "scope" : "GOOGLE",
         "types" : [ "florist", "store", "point_of_interest", "establishment" ],
         "vicinity" : "Golden Island (Kilmaine), Athlone"
      },
      {
         "geometry" : {
            "location" : {
               "lat" : 53.4232928,
               "lng" : -7.9396458
            },
            "viewport" : {
               "northeast" : {
                  "lat" : 53.42463542989272,
                  "lng" : -7.938276270107278
               },
               "southwest" : {
                  "lat" : 53.42193577010728,
                  "lng" : -7.940975929892722
               }
            }
         },
         "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/shopping-71.png",
         "id" : "66ba2e9350b7d1cd1183c3a278e9946d1e21d0fe",
         "name" : "Be Floral",
         "opening_hours" : {
            "open_now" : true
         },
         "photos" : [
            {
               "height" : 1440,
               "html_attributions" : [
                  "\u003ca href=\"https://maps.google.com/maps/contrib/109574484271593171379/photos\"\u003eA Google User\u003c/a\u003e"
               ],
               "photo_reference" : "CmRaAAAAEdHCug6ZcEp839GOoVYKUbWZqeW75DRzStWllllUzRHxmUtBObCmf6kajw6b-nK2aDlSamdKVFAAnWFyU7i4GoATn1JbVz0zRWGI0rmbZdyKQHKbxneo32tT_Pl3HsfPEhAeWIUO2lh-FaI8_Bxr2YwQGhQxy9LgWUd8ckYg3eV-IJJ-uEndPg",
               "width" : 1920
            }
         ],
         "place_id" : "ChIJ0SZ17ANJXEgR-5UdcJuIpM4",
         "plus_code" : {
            "compound_code" : "C3F6+84 Athlone, County Westmeath, Ireland",
            "global_code" : "9C5JC3F6+84"
         },
         "rating" : 0,
         "reference" : "CmRbAAAAujL-64C9k6SPSYVmc8RlqQXJBxPvviqqvzgb40ZJAz8kX4wWuqB_HWUO5D6VyTbSfMaUCa02hjVnRNzr9ISM_CdjkmIrNp2akwv7NznYDgF1o9xTGCMluuTT1MtpmFg3EhBS7eM287v1nw-30wu5IN-sGhTqZfI5f-qny12YPXJuvioHSwD-6g",
         "scope" : "GOOGLE",
         "types" : [ "florist", "store", "point_of_interest", "establishment" ],
         "vicinity" : "Lloyd's Ln, Loughanaskin, Athlone"
      },
      {
         "geometry" : {
            "location" : {
               "lat" : 53.43007069999999,
               "lng" : -7.8923063
            },
            "viewport" : {
               "northeast" : {
                  "lat" : 53.43142052989272,
                  "lng" : -7.890956470107278
               },
               "southwest" : {
                  "lat" : 53.42872087010728,
                  "lng" : -7.893656129892721
               }
            }
         },
         "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
         "id" : "559974f9849741660baafdbd433c5cb934f2f411",
         "name" : "Floral Cloud",
         "opening_hours" : {
            "open_now" : true
         },
         "photos" : [
            {
               "height" : 609,
               "html_attributions" : [
                  "\u003ca href=\"https://maps.google.com/maps/contrib/105597253291213300228/photos\"\u003eA Google User\u003c/a\u003e"
               ],
               "photo_reference" : "CmRaAAAAe-lw4ZpD_fbD5MTBOoKUOpYCYNTboDxFuu1r_j6elTPIu1_QMrZqzqBYzGf8iirE_feDjzeT6XRRWhTjNbaIBja500_FhA3zTAmibm0HFIoBHDhIGMRdWGfsMsypANB8EhC96QUKzxF5ez38wBflj0gZGhQrXVbi4WDiXebfOmjGVJ4EwFd4bA",
               "width" : 1084
            }
         ],
         "place_id" : "ChIJMdt-IoFIXEgRmdwzL8HC50Y",
         "plus_code" : {
            "compound_code" : "C4J5+23 Athlone, County Westmeath, Ireland",
            "global_code" : "9C5JC4J5+23"
         },
         "rating" : 4.3,
         "reference" : "CmRbAAAAkRrSGSx0ignasWUpJgWiSPgqqTpbr6ATUy3t-61nqH7FCvpnYmn1784H_CCfCzrSt_1uMrNwPHXRbmjFtbUuG5HAeWA7Db1Pu9G2SK9nvJTWbY6FzvOnjHU0sT2AexqmEhBAIgDxoWfQa9Sw9Pw-GIQVGhRY4qzIaUnfCPRW5HFwu3HEOmsqYA",
         "scope" : "GOOGLE",
         "types" : [ "point_of_interest", "establishment" ],
         "vicinity" : "Unit 50, Blyry Industrial Estate, Athlone"
      },
      {
         "geometry" : {
            "location" : {
               "lat" : 53.406841,
               "lng" : -7.938007
            },
            "viewport" : {
               "northeast" : {
                  "lat" : 53.40819082989272,
                  "lng" : -7.936657170107278
               },
               "southwest" : {
                  "lat" : 53.40549117010728,
                  "lng" : -7.939356829892722
               }
            }
         },
         "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
         "id" : "ba1b851568d90d433d8fc18a0ddda3446b7d962a",
         "name" : "Patricias Wedding Treasures",
         "opening_hours" : {
            "open_now" : true
         },
         "photos" : [
            {
               "height" : 480,
               "html_attributions" : [
                  "\u003ca href=\"https://maps.google.com/maps/contrib/117902390620131484671/photos\"\u003ePatricias Wedding Treasures\u003c/a\u003e"
               ],
               "photo_reference" : "CmRaAAAAkEmZoNaP4hqXcTH-3qKlyHNh5KQ3b05D3hASuqJ_oCOjnF0sBoBEGiM_AW111Kd60iwAX3GZMFTbvIB4Fhlg3OcIAlQiZWCBNuSpyUyhi1588s2MJgby7z5amSaGHf3hEhDq2CP7jIbbN6DQjnvHAC8mGhS_U7aX-r_BNy9V0iXMWfv5Wiez1A",
               "width" : 640
            }
         ],
         "place_id" : "ChIJu5v_RyBJXEgRGM1aYEvmD0w",
         "plus_code" : {
            "compound_code" : "C346+PQ Golden Island, County Westmeath, Ireland",
            "global_code" : "9C5JC346+PQ"
         },
         "rating" : 0,
         "reference" : "CmRbAAAAd1bct3aUQYrpSsnHs-DOedUAPYl9FuUO4P9blXwvSt21rhkm8-IoJkrFUtjRaSdD0S8UW9tnTEvienOZAJ86Wq8Ypeb5ylubHrmdBlmP8oFNHe6SDITXJ6JDcMp2L_UQEhDoSKhOwIsY1VI0VIVtv5NuGhSP45FmfICFqvJpZCPQ0bfSolwgEA",
         "scope" : "GOOGLE",
         "types" : [ "point_of_interest", "establishment" ],
         "vicinity" : "Golden Island, Athlone"
      },
      {
         "geometry" : {
            "location" : {
               "lat" : 53.4239152,
               "lng" : -7.989224200000001
            },
            "viewport" : {
               "northeast" : {
                  "lat" : 53.42556182989272,
                  "lng" : -7.988307570107279
               },
               "southwest" : {
                  "lat" : 53.42286217010728,
                  "lng" : -7.991007229892722
               }
            }
         },
         "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
         "id" : "abe41b107c9ab2fd16763225006b0072cf06f393",
         "name" : "Liam Kidney Photography",
         "opening_hours" : {
            "open_now" : true
         },
         "photos" : [
            {
               "height" : 1536,
               "html_attributions" : [
                  "\u003ca href=\"https://maps.google.com/maps/contrib/100645956983550164138/photos\"\u003eLiam Kidney\u003c/a\u003e"
               ],
               "photo_reference" : "CmRaAAAA0ZHwKonfbiEuX-zDNs2_U9704br-fmS9gqazgzajJ6j9_kzFTrY_qgVZlHF9UyaLKq-KvmRcaPpUAY0ILOljInTdTeQC_aZ7MHWEnNHEXoeHIT3EGAODZm9rREBRaMMLEhBziDTx76q3EzTrDKtyx-cTGhThlbSNYNPIDz5IBkW900I0n6RAdg",
               "width" : 2048
            }
         ],
         "place_id" : "ChIJL-WIf4hIXEgRTNE0T8MZBHQ",
         "plus_code" : {
            "compound_code" : "C2F6+H8 Monksland, County Roscommon, Ireland",
            "global_code" : "9C5JC2F6+H8"
         },
         "rating" : 5,
         "reference" : "CmRbAAAAinNcXzE02soMQisE8PC-LLmbXYXBh74SfpSEw4ODJghp8EGcA7E7zXoVxNG3xvLaRYCWk8h9qcQBqnqP6Oxzo3n0VcmbS5C0DJZs43NxFgLApnCPl8A85Gz7eynzaRWhEhDZfmuxwQCF4GfmiSz3j3GfGhQ8Za_ZMlHa1wmSHRPVtoIUEheg8w",
         "scope" : "GOOGLE",
         "types" : [ "point_of_interest", "establishment" ],
         "vicinity" : "50 Ross Árd, Monksland, Athlone"
      },
      {
         "geometry" : {
            "location" : {
               "lat" : 53.4763658,
               "lng" : -7.898927199999999
            },
            "viewport" : {
               "northeast" : {
                  "lat" : 53.47771562989273,
                  "lng" : -7.897577370107276
               },
               "southwest" : {
                  "lat" : 53.47501597010729,
                  "lng" : -7.900277029892719
               }
            }
         },
         "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/lodging-71.png",
         "id" : "202c490aa76d1fe877bae7b2a9b62e27ae2d187b",
         "name" : "Glasson Hotel & Golf Club",
         "opening_hours" : {
            "open_now" : true
         },
         "photos" : [
            {
               "height" : 2322,
               "html_attributions" : [
                  "\u003ca href=\"https://maps.google.com/maps/contrib/113442176282980152058/photos\"\u003emarcus 187\u003c/a\u003e"
               ],
               "photo_reference" : "CmRaAAAAUEX6VhfjaGdoaCbY1iI0sPx3ja2hU5CAB6JJB5DJ1idsc4Mdw3kJFnS2Mtqx61Ty9neRMR0Red0uyFu-gamqP_IHDsW_IaOenM1DT-vOqL8kpwakU0dvDm8WaCOn8eSOEhAqWy96iezK2c2opTlx2e_DGhSUD5-FiYnBkobMOOlN9trbk5Cogw",
               "width" : 4128
            }
         ],
         "place_id" : "ChIJrVOmAudJXEgRIqez0LFZyHI",
         "plus_code" : {
            "compound_code" : "F4G2+GC Killinure South, County Westmeath, Ireland",
            "global_code" : "9C5JF4G2+GC"
         },
         "rating" : 4.5,
         "reference" : "CmRbAAAA26_DiJ5XJ-sty-_bpm0A9X-UW6ftcB07mXCixo6e9Gqgqq4FslRqWzcBNJAWbmmhug_c1MorfCiQF52kJXNOxc-6X_fM2E-q853tp4F5OjzuxicBBK3AoOWcj73RwS2XEhBS2cSBMLVD84D4CPMaBtseGhQPEgR2oR-prQkK98Aj0nL1R1xSrg",
         "scope" : "GOOGLE",
         "types" : [
            "bar",
            "lodging",
            "restaurant",
            "food",
            "point_of_interest",
            "establishment"
         ],
         "vicinity" : "Killinure Cottage, Killinure, Athlone"
      },
      {
         "geometry" : {
            "location" : {
               "lat" : 53.430479,
               "lng" : -7.893891
            },
            "viewport" : {
               "northeast" : {
                  "lat" : 53.43182882989272,
                  "lng" : -7.892541170107278
               },
               "southwest" : {
                  "lat" : 53.42912917010727,
                  "lng" : -7.895240829892722
               }
            }
         },
         "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
         "id" : "b9a92eaa8780cc6b38232d20d0da5617c70e0304",
         "name" : "FCDM - Full Circle Digital Marketing",
         "opening_hours" : {
            "open_now" : true
         },
         "photos" : [
            {
               "height" : 607,
               "html_attributions" : [
                  "\u003ca href=\"https://maps.google.com/maps/contrib/112102288553428624320/photos\"\u003eFCDM\u003c/a\u003e"
               ],
               "photo_reference" : "CmRaAAAAlL1f48FXqYsCZgyqjCajqxFR5jq-48nv5AakzESAYlqk-kbeR1Zg4QayQtt74KUS6e_UTWdnD0DDFmTYDrtPZVqmj2Tjl4rABDJh1X9AOMF8A1QlrpqcR5Nky_7BQ-55EhCnXVkSGDC-dZP1rmp9iiFYGhQ0a1AbzgrnREnUOBcVsFh7XSebPg",
               "width" : 1080
            }
         ],
         "place_id" : "ChIJo0nTMY9IXEgRElwEQnqwbmI",
         "plus_code" : {
            "compound_code" : "C4J4+5C Athlone, County Westmeath, Ireland",
            "global_code" : "9C5JC4J4+5C"
         },
         "rating" : 3.7,
         "reference" : "CmRbAAAAkUitIdEDXa-ieKhT6AtJyTNUHWu4-x950qE5sPwujFW5-m65iSaYmx_QORopdZtyzIIZtxrmBeDHN3FA0LAXQxi3Blh5wpq1fkQDw4135pm9cYyIC4RIYMz2utgjvx1hEhC7PxyDVuZQw6GqjT3zZDgsGhS2sC-UlbjDCtkr4OVQQoRv1trv9Q",
         "scope" : "GOOGLE",
         "types" : [ "point_of_interest", "establishment" ],
         "vicinity" : "Unit 50, Blyry Business and Commercial Park., Athlone"
      },
      {
         "geometry" : {
            "location" : {
               "lat" : 53.4204895,
               "lng" : -7.9342238
            },
            "viewport" : {
               "northeast" : {
                  "lat" : 53.42183932989272,
                  "lng" : -7.932873970107278
               },
               "southwest" : {
                  "lat" : 53.41913967010728,
                  "lng" : -7.935573629892722
               }
            }
         },
         "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/shopping-71.png",
         "id" : "624d46cc4c06746da8bc9bd616f1844b63ab269b",
         "name" : "Golden Island Shopping Centre",
         "opening_hours" : {
            "open_now" : true
         },
         "photos" : [
            {
               "height" : 2268,
               "html_attributions" : [
                  "\u003ca href=\"https://maps.google.com/maps/contrib/109922865072642849852/photos\"\u003eBongani Mashengele\u003c/a\u003e"
               ],
               "photo_reference" : "CmRaAAAAAO7ai7tjnPI3wUyM_0tsVR7FlnxXrglecFW9hAKDFwjvmIBSxk9c2NvaAEQjCXl4WRU-h09jwm1-kq1dSIgYudW8tr_d9wxvUtIOTq1oz5BW6zv7HMZS8UeIVYV6dEwsEhBoJBgWrCHQW-OMaWDdUipbGhT11E8yQvzX8Tu-_AIEVXVJrhYHoQ",
               "width" : 4032
            }
         ],
         "place_id" : "ChIJbeXe5wRJXEgRcysPAxpgOX8",
         "plus_code" : {
            "compound_code" : "C3C8+58 Athlone, County Westmeath, Ireland",
            "global_code" : "9C5JC3C8+58"
         },
         "rating" : 4.3,
         "reference" : "CmRbAAAA4PYRNntFEbQ5Bbg9Bzzp9lncwKQOEccTsZ8zLqmdlh5mK0j-7wUCZNjmomBvXcAG_EVvR6wEeaAFkRvs704nZvoBYfbYa2NqAzsF_S2maj-ZyNGrSdaMWsqoXNF3a1vUEhALSMQDnpJUHuIxvQh5U_2PGhRQA_QuMGa5WorYG9eeh0KBpuQfhg",
         "scope" : "GOOGLE",
         "types" : [ "shopping_mall", "point_of_interest", "establishment" ],
         "vicinity" : "Golden Island, Golden Island (Kilmaine), Athlone"
      }
   ],
   "status" : "OK"
}
google-maps google-maps-api-3 google-places-api google-places
3个回答
0
投票

使用

input=nail%20salon

在您提供替换的网址中

name=nail%20salon

0
投票

您是否尝试使用Google的API nearbySearch(...)函数?该功能允许您指定三个参数:位置(纬度,经度坐标),半径(位置周围)和类型(类型是此处的关键字,因为基于此Google的API将确定搜索结果)。

var SearchPlaces = {
    GPMHotels: ['hotel']
    , GPMCoffeeShop: ['cafe']
    , GPMFoodPlaces: ['restaurant']
    , GPMShoppingPlaces: ['shopping_mall']
};

var service = new google.maps.places.PlacesService(GPMap);

function SearchGPMapServiceNearPlacesFn(service) {
    function GetHTML(place) {
        var distance = "";
        if (place.geometry && place.geometry.location) {
            var fromLatLng = new google.maps.LatLng(GPMapLocation.lat, GPMapLocation.lng);
            distance = google.maps.geometry.spherical.computeDistanceBetween(fromLatLng, place.geometry.location);
            distance = Math.ceil(distance).toLocaleString('@languaje');
        }
        var html = "* " + (distance ? distance + " m. " : "") + place.name + ".  "
                       + place.formatted_address + ".  " +
            (place.international_phone_number || "");
        return html;
    }

    function GetPlaceDetails(place_id) {
        if (!place_id) return;
        service.getDetails({
            placeId: place_id
        }, function (place, status) {
            if (status === google.maps.places.PlacesServiceStatus.OK) {
                //-->> console.log({ fn: 'GetPlaceDetails', item: place });
                $("#GPMNearSitesList").append($('<li>').html(GetHTML(place)));
            }
        });
    }

    service.nearbySearch({
        location: GPMapLocation,
        radius: GPMapOptions.searchRadiusList,
    },
    function (results, status) {
        if (status === google.maps.places.PlacesServiceStatus.OK) {
            for (var i = 0; i < results.length; i++) {
                GetPlaceDetails(results[i].place_id);
                //-->>console.log({ fn: "SearchGPMapServiceNearPlacesFn", item: results[i] });
            }
        }
    });
}

见:https://developers.google.com/places/web-service/search


© www.soinside.com 2019 - 2024. All rights reserved.