Here Maps Batch Geocode始终报错,如何获取单地址错误信息?
Here Maps批量地理编码任务报错排查问题
我正在测试Here Maps批量地理编码功能,通过Postman按文档提交批量请求:
POST https://batch.geocoder.ls.hereapi.com/6.2/jobs?apiKey={apiKey} &indelim=%7C &outdelim=%7C &action=run &outcols=displayLatitude,displayLongitude,locationLabel,houseNumber,street,district,city,postalCode,county,state,country &outputcombined=false
请求体内容:
recId|searchText|country 0001|Lehargasse 7, 1070 Vienna, Austria|AUT
提交后收到响应:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ns2:SearchBatch xmlns:ns2="http://www.navteq.com/lbsp/Search-Batch/1"> <Response> <MetaInfo> <RequestId>zcnz4RB0JtU8qeWqP49jLuVnS81SHBz6</RequestId> </MetaInfo> <Status>accepted</Status> <TotalCount>0</TotalCount> <ValidCount>0</ValidCount> <InvalidCount>0</InvalidCount> <ProcessedCount>0</ProcessedCount> <PendingCount>0</PendingCount> <SuccessCount>0</SuccessCount> <ErrorCount>0</ErrorCount> </Response> </ns2:SearchBatch>
随后执行状态查询请求:
GET https://batch.geocoder.ls.hereapi.com/6.2/jobs/zcnz4RB0JtU8qeWqP49jLuVnS81SHBz6?apiKey={apiKey}&action=status
得到状态响应:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ns2:SearchBatch xmlns:ns2="http://www.navteq.com/lbsp/Search-Batch/1"> <Response> <MetaInfo> <RequestId>zcnz4RB0JtU8qeWqP49jLuVnS81SHBz6</RequestId> </MetaInfo> <Status>completed</Status> <JobStarted>2023-07-16T07:56:23.000Z</JobStarted> <JobFinished>2023-07-16T07:56:25.000Z</JobFinished> <TotalCount>1</TotalCount> <ValidCount>1</ValidCount> <InvalidCount>0</InvalidCount> <ProcessedCount>1</ProcessedCount> <PendingCount>0</PendingCount> <SuccessCount>0</SuccessCount> <ErrorCount>1</ErrorCount> </Response> </ns2:SearchBatch>
当前问题:无论更换地址、调整地址数量,批量任务始终报错,且无法找到获取单条地址错误详情的方法进行调试。
调试方案
要获取单条地址的错误细节,需要执行结果下载请求,而非仅查询状态:
使用以下GET请求格式,替换{jobId}为你的任务ID、{apiKey}为你的密钥:
GET https://batch.geocoder.ls.hereapi.com/6.2/jobs/{jobId}/result?apiKey={apiKey}
返回的结果文件中会包含每条记录的完整状态,包括错误代码和描述,比如errorCode(如404)、errorMessage字段,可直接定位具体问题。
另外,也可以先用单地址地理编码接口测试目标地址的有效性,排除地址格式或数据本身的问题:
GET https://geocode.search.hereapi.com/v1/geocode?q=Lehargasse 7, 1070 Vienna, Austria&apiKey={apiKey}
内容的提问来源于stack exchange,提问作者chenny
相关产品推荐
相关产品推荐

