簡體   English   中英

將R package ggmap與Google Directions API令牌一起使用

[英]Using R package ggmap with Google Directions API token

我正在使用ggmap的“路線”功能來使用Google的Driving Directions API繪制行車路線。 我可能需要超過每日2,500個API限制。 我知道要超過這個門檻,我必須支付0.50美元/ 1000美元的點擊費並注冊Google Developers API令牌。 但是,我沒有看到ggmap庫或路由功能中的任何參數允許我輸入我的令牌和密鑰信息,以便我可以超過閾值。 我錯過了什么?

我已經編寫了googleway軟件包來訪問google maps API,您可以在其中指定令牌密鑰

例如

library(googlway)

key <- "your_api_key"
google_directions(origin = "MCG, Melbourne",
                  destination = "Flinders Street Station, Melbourne",
                  key = key,
                  simplify = F) ## use simplify = T to return a data.frame

[1] "{"                                                                                                                                                                                                                                                                                                                                                
[2] "   \"geocoded_waypoints\" : ["                                                                                                                                                                                                                                                                                                                    
[3] "      {"                                                                                                                                                                                                                                                                                                                                          
[4] "         \"geocoder_status\" : \"OK\","                                                                                                                                                                                                                                                                                                           
[5] "         \"partial_match\" : true,"                                                                                                                                                                                                                                                                                                               
[6] "         \"place_id\" : \"ChIJIdtrbupC1moRMPT0CXZWBB0\","                                                                                                                                                                                                                                                                                         
[7] "         \"types\" : ["                                                                                                                                                                                                                                                                                                                           
[8] "            \"establishment\","                                                                                                                                                                                                                                                                                                                   
[9] "            \"point_of_interest\","                                                                                                                                                                                                                                                                                                               
[10] "            \"train_station\","                                                                                                                                                                                                                                                                                                                   
[11] "            \"transit_station\""                                                                                                                                                                                                                                                                                                                  
[12] "         ]"                                                                                                                                                                                                                                                                                                                                       
[13] "      },"                                                                                                                                                                                                                                                                                                                                         
[14] "      {"                                                                                                                                                                                                                                                                                                                                          
[15] "         \"geocoder_status\" : \"OK\","                                                                                                                                                                                                                                                                                                           
[16] "         \"place_id\" : \"ChIJSSKDr7ZC1moRTsSnSV5BnuM\","                                                                                                                                                                                                                                                                                         
[17] "         \"types\" : ["                                                                                                                                                                                                                                                                                                                           
[18] "            \"establishment\","                                                                                                                                                                                                                                                                                                                   
[19] "            \"point_of_interest\","                                                                                                                                                                                                                                                                                                               
[20] "            \"train_station\","                                                                                                                                                                                                                                                                                                                   
[21] "            \"transit_station\""                                                                                                                                                                                                                                                                                                                  
[22] "         ]"                                                                                                                                                                                                                                                                                                                                       
[23] "      }"                                                                                                                                                                                                                                                                                                                                          
[24] "   ],"                                                                                                                                                                                                                                                                                                                                            
[25] "   \"routes\" : ["
... etc

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM