SymbolixAU / googleway

R Package for accessing and plotting Google Maps
http://symbolixau.github.io/googleway/
Other
234 stars 46 forks source link

googleway vs ggmap for Denmark #222

Closed GNtem2 closed 2 years ago

GNtem2 commented 4 years ago

@dcooley I ran some searches for Denmark but encountered a problem with googleway whereas this was not an issue with ggmap. I like googleway as it allows me to easily specify traffic model optimistic

The addresses were found by using google maps

Hospital<-"Italiensvej 1 Copenhagen"
Address=c("Rolighedsvej 8, Frederiksberg 84 1958","Søndre Fasanvej 90, 1. sal, Valby 84 2500","Rømersgade 7, 1th, København 84 1362")
google_distance(Address, Hospital, 
                key=key, 
                departure_time=as.POSIXct("2020-12-03 08:15:00 AEST"),
                traffic_model = "optimistic")
Error in value[[3L]](cond) : 
  There was an error downloading results. Please manually check the following URL is valid

ggmap::mapdist(Address,Hospital)
 from             to              m    km miles seconds minutes hours mode 
  <chr>            <chr>       <int> <dbl> <dbl>   <int>   <dbl> <dbl> <chr>
1 Rolighedsvej 8,~ Italiensve~  8897  8.90  5.53    1317    22.0 0.366 driv~
2 Søndre Fasanvej~ Italiensve~  5969  5.97  3.71     920    15.3 0.256 driv~
3 Rømersgade 7, 1~ Italiensve~  7005  7.00  4.35    1022    17.0 0.284 driv~
dcooley commented 4 years ago

Please manually check the following URL is valid

What URL did it give you?

GNtem2 commented 4 years ago

Thanks. Yes they are valid. ggmap uses google distance matrix api also found it as well

https://www.google.com.au/maps/place/Søndre+Fasanvej+84,+90,+1.+sal,+2000+Frederiksberg,+Denmark/@55.6782415,12.5187335,17z/data=!3m1!4b1!4m5!3m4!1s0x465253bf9ab826b1:0x42c5c1dc255c2bd6!8m2!3d55.6782385!4d12.5209222

https://www.google.com.au/maps/search/Rømersgade+7,+1th,+København+84+1362/@55.6833112,12.5655205,17z/data=!3m1!4b1

dcooley commented 4 years ago

Do you get any issues using these addresses in the google_geocode() function?


a1 <- google_geocode(address = Address[1])
a2 <- google_geocode(address = Address[2])
a3 <- google_geocode(address = Address[3])

googleway::geocode_address_components(a1)
# long_name      short_name                                       types
# 1               8               8                               street_number
# 2    Rolighedsvej    Rolighedsvej                                       route
# 3 Frederiksberg C Frederiksberg C political, sublocality, sublocality_level_1
# 4   Frederiksberg   Frederiksberg                         locality, political
# 5         Denmark              DK                          country, political
# 6            1958            1958                                 postal_code

googleway::geocode_address_components(a2)
# long_name      short_name               types
# 1      90, 1. sal      90, 1. sal          subpremise
# 2              84              84       street_number
# 3 Søndre Fasanvej Søndre Fasanvej               route
# 4   Frederiksberg   Frederiksberg locality, political
# 5         Denmark              DK  country, political
# 6            2000            2000         postal_code

googleway::geocode_address_components(a3)
# long_name  short_name                                       types
# 1           7           7                               street_number
# 2  Rømersgade  Rømersgade                                       route
# 3 København K København K political, sublocality, sublocality_level_1
# 4   København   København                         locality, political
# 5     Denmark          DK                          country, political
# 6        1362        1362                                 postal_code