【问题标题】:Automating extraction of latitude, longitude and other information about places from Google从 Google 自动提取纬度、经度和其他有关地点的信息
【发布时间】:2021-05-02 19:33:04
【问题描述】:

如果您在互联网浏览器中输入https://www.google.ca/maps/search/Southern+Saskatchewan, Google 会方便地(并且自动!)将您重定向到: https://www.google.ca/maps/search/Southern+Saskatchewan/@54.1966035,-115.5094433,5z/data=!3m1!4b1

从那里您可以看到并手动复制和粘贴有关该区域的纬度 (47.0159646)、经度 (-65.6188287) 和一些其他信息 (5z/data=!3m1!4b1 - 我不确定它是什么) (萨斯喀彻温省南部)。

有没有办法以某种方式自动化这个过程 - 以便可以使用 R 函数 retrievePlaceInfoFromGoogle <- function(strPlaceName) 检索此类信息?

也许使用 httr 或 rvest 或任何任何网络技术包?

【问题讨论】:

标签: r geolocation web-crawler rvest httr


【解决方案1】:

任何以“官方”方式以外的方式使用 Google 的尝试都将被阻止,您将收到“检测到异常交通通知”,并通过选择交通信号灯等方式测试您是否是人类。
地理编码的官方方式是通过 google API。获得 api 密钥后,您可以使用 googleway 包,例如:

require(googleway)
set_key("your_google_key_of_39_characters")
x= google_geocode(address = "Southern Saskatchewan", simplify = TRUE)
x$results$geometry

【讨论】:

  • 还有 Google 的替代品。例如:tidygeocoder::geo_osm('Southern Saskatchewan')
猜你喜欢
  • 2018-06-26
  • 1970-01-01
  • 1970-01-01
  • 2019-01-06
  • 1970-01-01
  • 1970-01-01
  • 2018-07-15
  • 1970-01-01
  • 2014-06-06
相关资源
最近更新 更多