【问题标题】:Rest API returning wrong resultRest API 返回错误结果
【发布时间】:2020-06-25 06:56:12
【问题描述】:

我打算从 json API 迁移到 rest API,但是结果不匹配,rest 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"
                        }
                    }
                }
            ]
        }
    ]
}

}

【问题讨论】:

    标签: here-api geocode


    【解决方案1】:

    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

    【讨论】:

    • 您好,感谢您的留言。但是,Rest API 结果不正确,因为我们可以看到 Json API 和 Rest API 之间的邮政编码不同,并且相距约 7Km。我刚刚向 Rest API 发出了一个新请求,现在它返回了正确的地址。请让我知道您已纠正任何问题。 revgeocode.search.hereapi.com/v1/…
    猜你喜欢
    • 2013-08-30
    • 2022-06-22
    • 2017-05-20
    • 1970-01-01
    • 2021-03-27
    • 1970-01-01
    • 1970-01-01
    • 2020-11-05
    • 1970-01-01
    相关资源
    最近更新 更多