我試圖提取在谷歌地圖上搜索公司名稱時顯示的詳細信息。如下面的圖所示:谷歌地圖API提取公司詳細信息
我厭倦了這http://maps.google.com/maps/api/geocode/json?address=
只給出的formatted_address。但我需要從結果中獲取網站和聯繫方式。有人可以幫助我使用什麼API?如果代碼是R或python,它也會很好。
我試圖提取在谷歌地圖上搜索公司名稱時顯示的詳細信息。如下面的圖所示:谷歌地圖API提取公司詳細信息
我厭倦了這http://maps.google.com/maps/api/geocode/json?address=
只給出的formatted_address。但我需要從結果中獲取網站和聯繫方式。有人可以幫助我使用什麼API?如果代碼是R或python,它也會很好。
由於@Procrastinatus指出,您可以使用我的googleway包在R中使用google_places()
函數執行此操作。而且您需要一個有效的Google API密鑰。
請注意,您在Google地圖上看到的內容並非總是由Places API返回。
library(googleway)
## your valid api key
# api_key <- read.dcf("~/Documents/.googleAPI", fields = "GOOGLE_API_KEY")
search_res <- google_places(search_string = "Olympus Avenue, Warwick, UK",
key = api_key)
search_res$results$name
# [1] "Holiday Inn Leamington Spa - Warwick"
search_res <- google_places(search_string = "Assured Property Group, UK",
key = api_key)
search_res$results$name
# [1] "Assured Property"
search_res$results$formatted_address
# [1] "77 Market St, Droylsden, Manchester M43 6DD, United Kingdom"
geo <- google_geocode(address = "Assured Property Group, Olympus Avenue, Warwick, UK",
key = api_key)
search_res <- google_places(location = c(geo$results$geometry$location$lat,
geo$results$geometry$location$lng),
radius = 1000,
key = api_key)
search_res$results$name
# [1] "Holiday Inn Leamington Spa - Warwick" "McDonald's"
# [3] "Pure Offices Leamington Spa" "Canute Group"
# [5] "Local Taxis" "Timpson Locksmith's & Safe Engineers"
# [7] "mplcontact" "Roast Coffee Weight Loss"
# [9] "We Buy Your Tyres" "Diamond Taxis"
# [11] "NS Line Cars" "Costa Coffee Drive Thru"
你有什麼輸入?地址?公司名稱? –
對於R你可以試試[googleway包](https://github.com/SymbolixAU/googleway)。 – Jaap