诺基亚在这里为单个lat长度返回两个位置

时间:2013-11-15 11:16:01

标签: json here-api reverse-geocoding

当我为一个长时间的诺基亚反向地理编码调用时,它会返回两个结果(带地址的位置)为单个lat长。 例如。当我使用以下查询URL时:

URL url = new URL("http://reverse.geocoder.cit.api.here.com/6.2/reversegeocode.json?prox=-53.31553,-68.64149999999998,1000&gen=1&mode=retrieveAddresses&app_id=oOnEEaBPJEG9JTqwTyjZ&app_code=WV2t5lCfD0NGpQMEjS2VBw");

我得到了以下结果:

{
   "Response":{
      "MetaInfo":{
         "Timestamp":"2013-11-15T10:52:24.684+0000"
      },
      "View":[
         {
            "_type":"SearchResultsViewType",
            "ViewId":0,
            "Result":[
               {
                  "Relevance":1.0,
                  "Distance":615.1,
                  "MatchLevel":"street",
                  "MatchQuality":{
                     "Country":1.0,
                     "State":1.0,
                     "County":1.0,
                     "City":1.0,
                     "District":1.0,
                     "Street":[
                        1.0
                     ],
                     "PostalCode":1.0
                  },
                  "Location":{
                     "LocationId":"Link_811555088_R",
                     "LocationType":"point",
                     "DisplayPosition":{
                        "Latitude":-53.3246228,
                        "Longitude":-68.6432568
                     },
                     "MapView":{
                        "TopLeft":{
                           "Latitude":-53.32214,
                           "Longitude":-68.64146
                        },
                        "BottomRight":{
                           "Latitude":-53.32497,
                           "Longitude":-68.65595
                        }
                     },
                     "Address":{
                        "Label":"257-CH, 6300000 Porvenir, Magallanes y La Antártica Chilena, República de Chile",
                        "Country":"CHL",
                        "State":"Magallanes y La Antártica Chilena",
                        "County":"Tierra del Fuego",
                        "City":"Porvenir",
                        "Street":"257-CH",
                        "PostalCode":"6300000",
                        "AdditionalData":[
                           {
                              "value":"República de Chile",
                              "key":"CountryName"
                           },
                           {
                              "value":"Magallanes y La Antártica Chilena",
                              "key":"StateName"
                           }
                        ]
                     },
                     "MapReference":{
                        "ReferenceId":"811555088",
                        "SideOfStreet":"right",
                        "CountryId":"23488354",
                        "StateId":"23488754",
                        "CountyId":"23489032",
                        "CityId":"23488149"
                     }
                  }
               },
               {
                  "Relevance":1.0,
                  "Distance":627.0,
                  "MatchLevel":"street",
                  "MatchQuality":{
                     "Country":1.0,
                     "State":1.0,
                     "County":1.0,
                     "City":1.0,
                     "District":1.0,
                     "Street":[
                        1.0
                     ],
                     "PostalCode":1.0
                  },
                  "Location":{
                     "LocationId":"Link_925101778_L",
                     "LocationType":"point",
                     "DisplayPosition":{
                        "Latitude":-53.32497,
                        "Longitude":-68.64146
                     },
                     "MapView":{
                        "TopLeft":{
                           "Latitude":-53.32145,
                           "Longitude":-68.64146
                        },
                        "BottomRight":{
                           "Latitude":-53.32497,
                           "Longitude":-68.62151
                        }
                     },
                     "Address":{
                        "Label":"Ruta Complementaria I, 9420 Río Grande, Argentina",
                        "Country":"ARG",
                        "State":"Tierra del Fuego",
                        "County":"Río Grande",
                        "City":"Río Grande",
                        "Street":"Ruta Complementaria I",
                        "PostalCode":"9420",
                        "AdditionalData":[
                           {
                              "value":"Argentina",
                              "key":"CountryName"
                           },
                           {
                              "value":"Tierra del Fuego",
                              "key":"StateName"
                           }
                        ]
                     },
                     "MapReference":{
                        "ReferenceId":"925101778",
                        "SideOfStreet":"left",
                        "CountryId":"23294156",
                        "StateId":"23294735",
                        "CountyId":"3458765894026227595",
                        "CityId":"23294619"
                     }
                  }
               }
            ]
         }
      ]
   }
}

获得两个位置。首先将该国作为智利,将下一个国家作为阿根廷。哪个是正确的结果?

1 个答案:

答案 0 :(得分:1)

正如我从api响应中看到的那样,API本身并不知道答案。看看这个街区:

"MatchQuality":{
   "Country":1.0
}

两个结果中的国家匹配质量相同。如果你在谷歌地图上查看这个地址 - 你会发现它非常接近边界。鉴于地图上的边界不是很精确,很容易理解为什么它不知道它是哪个国家。

所以,你有两个选择:

  1. 选择第一个。
  2. 确定距离最近的物体的距离。您在附近找到了两个物体,而距离较小的物体在智利。所以你可以选择它,但很有可能它是正确的。