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

Here.com Places Autosuggest API分类过滤功能失效求助

Troubleshooting Here Places Autosuggest API Category Filter Issues

Let’s break down why your education-facility (and even restaurant) filters aren’t working as expected, and how to fix them:

1. Verify the Correct Category Key Format

Here’s the thing: the Places API uses lowercase category keys (like education-facility) which matches what you’re using, but Autosuggest often responds better to more specific sub-categories instead of top-level ones. For education-related results, try school or university instead of the broad education-facility—these are more granular and tend to trigger targeted suggestions.

Double-check that you’re not using display names (like "Educational Facility")—those won’t work; stick to the machine-readable keys from the documentation.

2. Understand Autosuggest’s Filter Logic (It’s Not Strict!)

This is a common gotcha: the category parameter in Autosuggest is a bias, not a strict filter. The API still prioritizes popular/nearby results (like cities or regions) even if you specify a category, especially if your search term ("strathcona") strongly maps to those broader places.

If you need only results from your target category, switch to the Places Search API (/places/v1/discover/search endpoint) instead—it’s designed for precise filtered searches, whereas Autosuggest is built for fast, flexible suggestions.

3. Fix URL & Parameter Issues

First, make sure your URL uses plain & instead of & (while some clients handle this, it can cause parameter parsing errors). Here’s a cleaned-up test call to try with a specific sub-category:

https://places.cit.api.here.com/places/v1/autosuggest?app_id=YOUR_APP_ID&app_code=YOUR_APP_CODE&q=strathcona&at=53.631611,-113.323975&category=school

Also, confirm that the coordinates in at are near actual educational facilities—run a test without the category parameter first to see if any schools show up in the unfiltered results. If none appear, the issue might be that there aren’t relevant places near that location, not the filter itself.

4. Troubleshooting the Restaurant Filter

Same logic applies here: use specific sub-categories like restaurant (the correct key) or fast-food instead of relying on broader terms. If even that doesn’t work, test the Search API with the same category to rule out API key/permission issues.

Final Recommendation

For strict category filtering, the Places Search API is the better tool. If you need to stick with Autosuggest, pair the specific sub-category with the strictbounds parameter (set to true) to force results to stay within the area around your at coordinates—this reduces the chance of broader, off-category suggestions.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.12 04:22:13