如何在HERE批量地理编码上使用wget发送文件

问题描述 投票:0回答:1

我希望在HERE batch geocoding api的帮助下从批次地址列表中获取经度和经度。你能帮我通过POST发送文件“addresses.txt”吗?我在linux mint中尝试了命令并收到“Error 400”。 :'(

wget --header="Content-Type: text/plain; charset=UTF-8" --post-file=addresses.txt"https://batch.geocoder.api.here.com/6.2/jobs?&app_code=xxxxx&app_id=xxxxxxx&action=run&header=true&inDelim=;&outDelim=,&outCols=recId,latitude,longitude,locationLabel&mailto=xxxxxxx&outputcombined=true&language=pt-BR"

我的文本文件只包含地址,没有标题,每行代表不同的地址,总共30,000行。

例:

street of the apple, 01, center, são paulo-SP
street of orange, 15, center, são paulo-SP

它可以是另一种替代“cmd”,“shell windows”。谢谢!

rest http-post here-api geocoder
1个回答
0
投票

400表示请求格式错误。换句话说,客户端发送到服务器的数据流不遵循规则。在具有JSON有效负载的REST API的情况下,通常我会说400,用于表示JSON根据服务的API规范以某种方式无效。

地址数据可以是结构化的(合格的)或非结构化的(自由形式)。以下是具有自由格式地址的输入文件的示例,其中国家/地区代码限定符使用“|”作为分隔符。第一行是一个标题,列出输入文件中列的名称。以下是完全限定格式的相同地址的示例:列recId是可选的。如果提供,则在输出中重复以供参考。如果数据中出现分隔符,则必须用双引号括起数据。下面的示例说明了分隔符是逗号并且输入包含逗号的情况。每个输入行的单个双引号(“)被视为常规字符。以下示例显示正确的输入行。相比之下,下面显示的示例无效。没有结束引号,导致四个而不是三个字段服务期望的每个输入行。

recId | searchText | country 1 | 425 W Randolph St,Chicago Illinois 60606 | USA 2 | 31 St James Ave Boston MA 02116 | USA 3 | 10115 Berlin Invalidenstrasse 117 | DEU

recId | street | city | postalCode | country 1 | 425 Randolph St | Chicago || USA 2 | 31 St James Ave | Boston | 02116 | USA 3 | Invalidenstrasse 117 | Berlin | 10115 | DEU

recId,searchText,country 1,“Sturmstraße8,80687Munich”,DEU 2,“Milano”,ITA 3,“Rome”,ITA 4,“Tecklenburger Strasse,Westerkappeln 49492”,ENG 5,“425 W Randolph St Chicago,伊利诺伊州,60606“,美国

recId,searchText,country 1,O“Farell St San Francisco,USA

recId,搜索文本,国家1,“Sturmstraße8,80687München,DE

Dummy address.txt $ cat address.txt recId,searchText,country 1,“Sturmstrasse 8,80687 Munich”,DEU 2,“Milano”,ITA 3,“Rome”,ITA 4,“Tecklenburger Strasse,Westerkappeln 49492”,DEU 5,“425 W Randolph St,Chicago,Illinois,60606”,USA

wget --header =“Content-Type:text / plain; charset = UTF-8”--post-file = address.txt“https://batch.geocoder.api.here.com/6.2/jobs?&app_code=xxxxxxx&app_id=xxxxxxx&action=run&header=true&inDelim=,&outDelim=,&outCols=recId,latitude,longitude,locationLabel&[email protected]&outputcombined=true&language=de-DE

--2019-03-14 15:12:02-- https://batch.geocoder.api.here.com/6.2/jobs?&app_code=xxxx&app_id=xxxxx&action=run&header=true&inDelim=,&outDelim=,&outCols=recId,latitude,longitude,locationLabel&[email protected]&outputcombined=true&language=de-DE解析batch.geocoder.api.here.com(batch.geocoder.api.here.com)... 52.33.227.75,52.35.120.176连接批处理。 geocoder.api.here.com(batch.geocoder.api.here.com)| 52.33.227.75 |:443 ...已连接。发送HTTP请求,等待响应... 200长度:468 [application / xml]保存到:'jobs?&app_code = xxxx&app_id = xxxxxx&action = run&header = true&inDelim =,&outDelim =,&outCols = recId,latitude,longitude,locationLabel&mailto = xyz @ gmail.com&outputcombined =真语言= DE-DE”

工作?&app_code = xxx&app_id = xxxx 100%[======================================== ================================================== ===============================================>] 468 --.- KB / s in 0s

2019-03-14 15:12:04(26.3 MB / s) - 'jobs?&app_code = xxxx&app_id = xxxxx&action = run&header = true&inDelim =,&outDelim =,&outCols = recId,latitude,longitude,locationLabel&mailto = xyz @ gmail.com&outputcombined =真和语言= de-DE'保存[468/468]

© www.soinside.com 2019 - 2024. All rights reserved.