HERE地址解析响应中缺少matchType

时间:2018-07-11 12:35:01

标签: here-api

HERE地理编码文档说there's a "MatchType" result ("quality of the location match, either pointAddress or interpolated")。不过,我没有收到。这是一个curl示例请求:

$ curl -G https://geocoder.cit.api.here.com/6.2/geocode.json --data-urlencode "app_id=XXX" --data-urlencode "app_code=YYYY" --data-urlencode "searchtext=Plaza España, Valladolid, Spain" | json_pp
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   916  100   916    0     0   4182      0 --:--:-- --:--:-- --:--:--  4182
{
   "Response" : {
      "MetaInfo" : {
         "Timestamp" : "2018-07-11T12:21:43.726+0000"
      },
      "View" : [
         {
            "_type" : "SearchResultsViewType",
            "Result" : [
               {
                  "MatchQuality" : {
                     "Country" : 1,
                     "City" : 1,
                     "District" : 1
                  },
                  "Location" : {
                     "DisplayPosition" : {
                        "Latitude" : 41.65039,
                        "Longitude" : -4.72559
                     },
                     "LocationType" : "point",
                     "MapView" : { 
                        "BottomRight" : { 
                           "Longitude" : -4.71874,
                           "Latitude" : 41.64807
                        },  
                        "TopLeft" : { 
                           "Longitude" : -4.72961,
                           "Latitude" : 41.65196
                        }   
                     },  
                     "LocationId" : "NT_zM4WS5CjEFeGmNW-rZko9A",
                     "Address" : { 
                        "District" : "Plaza España",
                        "County" : "Valladolid",
                        "Country" : "ESP",
                        "City" : "Valladolid",
                        "State" : "Castilla y León",
                        "PostalCode" : "47002",
                        "Label" : "Plaza España, Valladolid, Castilla y León, España",
                        "AdditionalData" : [ 
                           {   
                              "value" : "España",
                              "key" : "CountryName"
                           },
                           {   
                              "key" : "StateName",
                              "value" : "Castilla y León"
                           },
                           {
                              "value" : "Valladolid",
                              "key" : "CountyName"
                           }
                        ]
                     },
                     "NavigationPosition" : [
                        {
                           "Longitude" : -4.72559,
                           "Latitude" : 41.65039
                        }
                     ]
                  },
                  "Relevance" : 1,
                  "MatchLevel" : "district"
               }
            ],
            "ViewId" : 0
         }
      ]
   }
}

1 个答案:

答案 0 :(得分:1)

关于这一点的文档不是很清楚。

匹配类型表示门牌号匹配的精度。如果该地点有地址,您将得到一个 pointAddress 内插的,但是如果根本没有门牌号,则将MatchType排除在响应之外。如果数据来自某个地址范围,则会发生插值响应,因此会为该位置计算边界框,例如,将1-4单元标识为建筑物中的联排别墅,但您搜索了3单元。 / p>

在此示例中,由于似乎您正在搜索地标,因此数字地址matchType的精度不会在响应中出现。