本文介绍了Google Geocoding API返回错误的语言作为响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目要求使用Geocoding API来坐标和更正乌克兰敖德萨的完整地址.

My project requests Geocoding API for coordinates and correct full addresses in Odessa, Ukraine.

我可以用俄语或乌克兰语请求响应,在HTTP请求中添加language=ru(language=uk)参数.从今天开始,无论我在请求中指定哪种语言,我都会得到乌克兰的街道名称.

I could request response in Russian or Ukrainian language adding language=ru (language=uk) parameter to the HTTP request. Starting today I get street name in Ukrainian in response, no matter which language I specify in request.

示例.

俄语请求:https://maps.googleapis.com/maps/api/geocode/json?address=Пушкинская, Одесса, Украина&language=ru

响应的相关部分:

"results" : [
  {
     "address_components" : [
        {
           "long_name" : "Пушкінська вулиця",
           "short_name" : "Пушкінська вулиця",
           "types" : [ "route" ]
        },
        {
           "long_name" : "Приморський район",
           "short_name" : "Приморський район",
           "types" : [ "sublocality_level_1", "sublocality", "political" ]
        },
        {
           "long_name" : "Одеса",
           "short_name" : "Одеса",
           "types" : [ "locality", "political" ]
        },
        {
           "long_name" : "Одесский горсовет",
           "short_name" : "Одесский горсовет",
           "types" : [ "administrative_area_level_3", "political" ]
        },
        {
           "long_name" : "Одеська область",
           "short_name" : "Одеська область",
           "types" : [ "administrative_area_level_1", "political" ]
        },
        {
           "long_name" : "Украина",
           "short_name" : "UA",
           "types" : [ "country", "political" ]
        }
     ],

请注意,"country""administrative_area_level_3"字段应使用俄语,但其他所有字段都使用乌克兰语.

Please note, that "country" and "administrative_area_level_3" fields are in Russian, as they should be, but everything else is in Ukrainian.

如果我使用language=uk,则响应中的所有字段均以乌克兰语言(按预期方式)返回.

If I use language=uk all fields in the response are returned in Ukrainian language (as intended).

我想Google的某个人将俄语和乌克兰语列表合并了,因此我无能为力地恢复俄语名称.所以问题更多是关于我应该在哪里报告此错误?

I suppose someone at Google merged Russian and Ukrainian lists, and there nothing I can do to get Russian names back on my end. So the question is more about where I should report this bug?

推荐答案

您可以报告地理编码api问题此处.

You can report a geo-coding api issue here.

点击新问题",然后在模板"下选择地理编码API-错误".

Hit "New Issue," and under "Template" select "Geocoding API - Bug."

祝你好运.

这篇关于Google Geocoding API返回错误的语言作为响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 17:04
查看更多