REST API返回错误结果

时间:2020-06-25 06:56:12

标签: here-api geocode

我正计划从json API迁移到其余API,但是结果不匹配,其余API的反向地址解析返回错误的结果。有人遇到过这个问题吗?在下面找到示例:

https://revgeocode.search.hereapi.com/v1/revgeocode?at=-32.05786%2C115.93382&lang=en-US&apiKey={KEY}

enter code here {
"items": [
    {
        "title": "Reece Australia",
        "id": "here:pds:place:036qd63w-93b4e78634c7482aa36a7140fde9701b",
        "resultType": "place",
        "address": {
            "label": "Reece Australia, Thornlie WA 6108, Australia",
            "countryCode": "AUS",
            "countryName": "Australia",
            "state": "Western Australia",
            "city": "Perth",
            "district": "Thornlie",
            "postalCode": "6108"
        },
        "position": {
            "lat": -32.05779,
            "lng": 115.93393
        },
        "access": [
            {
                "lat": -32.05779,
                "lng": 115.93393
            }
        ],
        "distance": 13,
        "categories": [
            {
                "id": "700-7400-0366",
                "primary": true
            }
        ]
    }
]

}

https://reverse.geocoder.ls.hereapi.com/6.2/reversegeocode.json?apiKey={APIKEY}&mode=retrieveAddresses&prox=-32.05786,115.93382&maxresults=1

enter code here {
"Response": {
    "MetaInfo": {
        "Timestamp": "2020-06-25T05:17:32.232+0000",
        "NextPageInformation": "2"
    },
    "View": [
        {
            "_type": "SearchResultsViewType",
            "ViewId": 0,
            "Result": [
                {
                    "Relevance": 1.0,
                    "Distance": 2.1,
                    "MatchLevel": "street",
                    "MatchQuality": {
                        "Country": 1.0,
                        "State": 1.0,
                        "City": 1.0,
                        "District": 1.0,
                        "Street": [
                            1.0
                        ],
                        "PostalCode": 1.0
                    },
                    "Location": {
                        "LocationId": "NT_K800C2SShmW5hJiQktPlsB_l_133454375_L",
                        "LocationType": "point",
                        "DisplayPosition": {
                            "Latitude": -32.0578752,
                            "Longitude": 115.9338325
                        },
                        "MapView": {
                            "TopLeft": {
                                "Latitude": -32.05782,
                                "Longitude": 115.9337
                            },
                            "BottomRight": {
                                "Latitude": -32.05798,
                                "Longitude": 115.9339
                            }
                        },
                        "Address": {
                            "Label": "Bannister Rd, Canning Vale WA 6155, Australia",
                            "Country": "AUS",
                            "State": "WA",
                            "City": "Perth",
                            "District": "Canning Vale",
                            "Street": "Bannister Rd",
                            "PostalCode": "6155",
                            "AdditionalData": [
                                {
                                    "value": "Australia",
                                    "key": "CountryName"
                                },
                                {
                                    "value": "Western Australia",
                                    "key": "StateName"
                                }
                            ]
                        },
                        "MapReference": {
                            "ReferenceId": "133454375",
                            "Spot": 0.66,
                            "SideOfStreet": "neither",
                            "CountryId": "1469256839",
                            "StateId": "1469256834",
                            "CityId": "1469263736",
                            "DistrictId": "1469282231"
                        }
                    }
                }
            ]
        }
    ]
}

}

1 个答案:

答案 0 :(得分:0)

Rest API提供的结果正确,因为您在该坐标处获得准确的结果。 而在JSON API中,您正在通过retrieveAddresses传递邻近位置,该位置总是搜索最接近的街道地址或给定邻近位置中的地址。

有关更多详细信息,您可以访问这两个API的文档。 https://developer.here.com/documentation/geocoding-search-api/api-reference-swagger.html https://developer.here.com/documentation/geocoder/dev_guide/topics/resource-reverse-geocode.html