使用谷歌风格的地址搜索查询添加经度和纬度

问题描述

我想添加特定地址的经度和纬度。我的输入数据是一个包含 1540 个地址的向量(按照我的理解应该不会超过每日查询的限制),形式如下:

                                             gmapsinput
1                        Carl-Zeiss-str.+85+73431+Aalen
2                             Ulmerstr.+150+73431+Aalen
3             Wilhelmstr.+50+73433+Aalen+Wasseralfingen
4  Hubertus-Liebrecht-str.+40+88400+Biberach+Aspach+Süd
5                       Waldseerstr.+143+88400+Biberach
6       Obertürkheimerstr.+82+73733+Esslingen+Mettingen
7     Stauffenbergstr.+29+73730+Esslingen+Oberesslingen
8           Ignaz-Gfell-Platz+3+79868+Feldberg+Bärental
9                             Luzinweg+4+17258+Feldberg
10           Carl-Kistner-str.+2+79115+Freiburg+Haslach

如果我通过 set.api.key() 设置 api 密钥(我的特定密钥与 gmapsdistance 计算一起使用,所以它不能是密钥不起作用)并尝试在此处找到的代码 R-Geocoding with Address不起作用,出现以下错误Warnung: Geocoding "Carl-Zeiss-str.+8..." Failed with error: This API project is not authorized to use this API. 我的代码是这样的:

for(i in 1:nrow(gmaps))
{
  # Print("Working...")
  result <- geocode(gmaps$gmapsinput[i],output = "latlona",source = "google")
  gmaps$lon[i] <- as.numeric(result[1])
  gmaps$lat[i] <- as.numeric(result[2])
  gmaps$geoAddress[i] <- as.character(result[3])
}

感谢任何帮助!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)