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

Google Places REST API指定类型过滤无效问题咨询

Fixing Google Places Nearby Search Not Filtering Restaurants Correctly

Hey there, let's work through why your Places API request isn't returning the restaurant results you expect. First off, there's a clear formatting mistake in your request URL that's throwing off the API's ability to parse your filters:

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=lat,long&radius=50&type=restaurantkeyword=restaurant&key=MY_API_KEY

The Core Issue: Malformed Parameter Separation

You've merged two parameters (type=restaurant and keyword=restaurant) together without the required & separator. Also, & is an HTML-escaped version of &—when building a raw request URL, you should use plain & to split parameters. Here's the corrected, functional URL:

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=lat,long&radius=50&type=restaurant&keyword=restaurant&key=MY_API_KEY

Additional Troubleshooting Steps

  • Validate Your Coordinates: Double-check that lat,long is a precise, valid location. A 50-meter radius is extremely small—there might simply be no restaurants in that tiny area! Try expanding the radius to 200-500 meters for testing.
  • Simplify the Request: Temporarily remove the keyword=restaurant parameter and test with just type=restaurant. Combining type and keyword can sometimes over-filter results, especially in limited geographic ranges.
  • Check API Key Permissions: Confirm your API key has the Places API enabled in the Google Cloud Console. Also, make sure you haven't hit your usage quota or been restricted from accessing the service.
  • Inspect API Responses: If you get an error like INVALID_REQUEST, read the error message closely—it will explicitly tell you what's wrong. If you get empty results, that’s a sign there are no matching restaurants in your specified radius and location.

内容的提问来源于stack exchange,提问作者Gastón Saillán

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.26 08:24:56