使用Here逆地理编码接口获取时区失败请求技术协助
Hey there, let's figure out why you're not seeing time zone data in your API responses even when including the locationattributes=timeZone parameter. Here are the most likely fixes to try:
1. Fix Parameter Formatting Issues
Looking at your request URL, I notice two critical formatting problems that might be causing the API to ignore your locationattributes parameter entirely:
- You’re using HTML-encoded
&instead of plain&to separate parameters. Most HTTP clients won’t parse this correctly, so thelocationattributesparameter is never actually recognized by the API. - There’s an extra space before
locationattributes=timeZone— this makes the parameter name invalid (it becomes " locationattributes" with a leading space, which the API doesn’t recognize).
Corrected Request URL:
https://reverse.geocoder.api.here.com/6.2/reversegeocode.json?prox=47.2094,8.6908,250&mode=retrieveAreas&maxresults=1&level=city&locationattributes=timeZone&gen=8&app_id={mymappid}&app_code={myappcode}
2. Verify Mode and Level Compatibility
The mode=retrieveAreas setting might not support returning time zone attributes for the level=city tier. Try adjusting these parameters to test:
- Switch to
mode=retrieveAddresses— this mode is optimized to return detailed location attributes alongside address data. - Try changing
leveltotimezoneorcountry— time zone data is often more reliably returned at broader geographic levels.
3. Check API Credential Permissions
Double-check that your app_id and app_code have permissions to access time zone data. Some HERE API tiers (especially free or trial plans) might restrict access to certain location attributes. You can confirm this by reviewing your account settings in the HERE Developer Portal.
4. Validate API Version Support
You’re using gen=8 with the v6.2 API. While this version should support locationattributes=timeZone, it’s worth confirming there aren’t version-specific limitations. If the above fixes don’t work, try testing with the latest recommended generation value for v6.2 (refer to the official API documentation for this detail).
If you still don’t see time zone data after these steps, inspect the raw API response for error messages or warnings — sometimes the API will explicitly hint at why certain attributes aren’t being returned.
内容的提问来源于stack exchange,提问作者Jonny

