【问题标题】:Here Geocoding: Unable to search by Canadian postal codes此处地理编码:无法按加拿大邮政编码搜索
【发布时间】:2020-11-19 12:48:08
【问题描述】:

我们最近尝试迁移到新的 Geocoding api v7,但在加拿大按邮政编码搜索时遇到了问题。使用以前版本的 API,我们收到了正确的结果,但现在服务什么也没返回。

这是我正在使用的网址:

https://geocode.search.hereapi.com/v1/geocode?apikey={myKey}&q=g1r4w4

返回为空{"items":[]}

之前,我们使用的是这个网址:

https://geocoder.api.here.com/6.2/geocode.json?app_id={appId}&app_code={appCode}&searchtext=g1r4w4

此调用正确地返回了与邮政编码相关的结果。

{"Response":{"MetaInfo":{"Timestamp":"2020-11-19T12:43:47.455+0000"},"View":[{"_type":"SearchResultsViewType","ViewId":0,"Result":[{"Relevance":1.0,"MatchLevel":"postalCode","MatchQuality":{"PostalCode":1.0},"Location":{"LocationId":"NT_yQ4FsR2UeO4wRSzRRMGA0B","LocationType":"point","DisplayPosition":{"Latitude":46.80349,"Longitude":-71.22871},"NavigationPosition":[{"Latitude":46.80349,"Longitude":-71.22871}],"MapView":{"TopLeft":{"Latitude":46.81698,"Longitude":-71.24842},"BottomRight":{"Latitude":46.79,"Longitude":-71.209}},"Address":{"Label":"G1R 4W4, Québec, QC, Canada","Country":"CAN","State":"QC","County":"Québec","City":"Québec","PostalCode":"G1R 4W4","AdditionalData":[{"value":"Canada","key":"CountryName"},{"value":"Québec","key":"StateName"},{"value":"Québec","key":"CountyName"}]}}}]}]}}

我在这里缺少什么来使它工作吗?

【问题讨论】:

标签: here-api


【解决方案1】:

请注意已经有一些改进,您的请求同时显示以下响应:

{

"items": [
    {
        "title": "G1R 4W4 Avenue de Bourlamaque, Québec, QC, Canada",
        "id": "here:af:streetsection:uBCczpZNke89jNSCVVy-WA:EAMyB2cxcnw0dzQ",
        "resultType": "postalCodePoint",
        "address": {
            "label": "G1R 4W4 Avenue de Bourlamaque, Québec, QC, Canada",
            "countryCode": "CAN",
            "countryName": "Canada",
            "stateCode": "QC",
            "state": "Québec",
            "county": "Québec",
            "city": "Québec",
            "district": "Vieux-Québec-Montcalm",
            "street": "Avenue de Bourlamaque",
            "postalCode": "G1R 4W4"
        },
        "position": {
            "lat": 46.80349,
            "lng": -71.22871
        },
        "access": [
            {
                "lat": 46.80349,
                "lng": -71.22871
            }
        ],
        "mapView": {
            "west": -71.23035,
            "south": 46.80237,
            "east": -71.22707,
            "north": 46.80461
        },
        "scoring": {
            "queryScore": 1.0,
            "fieldScore": {
                "postalCode": 1.0
            }
        }
    }
]

}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-02-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多