You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Google Place API附近搜索多类型参数传递失败的技术咨询

Google Places Nearby Search: Multiple Types Limitation & Workarounds

Hey there! I’ve run into this exact issue before, so let me break it down for you:

The Nearby Search endpoint of the Google Places API does not support multiple values for the types parameter — that’s why both types=atm|restaurant and types=atm,restaurant aren’t working for you. This is an intentional limitation of the endpoint; it only accepts a single type value at a time.

Workarounds to get results for multiple types:

  • Use the keyword parameter instead: You can combine your desired types as keywords, which the API will use to match relevant places. For example:

    https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=30.642550,76.817336&key=examplekey&sensor=false&radius=200&keyword=atm,restaurant
    

    You can also use space-separated keywords like keyword="atm restaurant" for broader matching.

  • Make separate requests for each type: If you need precise results for each type, send one Nearby Search request for types=atm and another for types=restaurant, then merge the results on your client side. Just keep in mind that each request counts against your API quota.

  • Switch to the Place Text Search endpoint: This endpoint does support multiple types using the | separator. The tradeoff is that Text Search is more focused on text-based matching rather than strict proximity, but it can work for your use case. Example request:

    https://maps.googleapis.com/maps/api/place/textsearch/json?query=near+30.642550,76.817336&key=examplekey&radius=200&types=atm|restaurant
    

Hope one of these solutions works for you!

内容的提问来源于stack exchange,提问作者user1001176

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 06:19:59