hello i donot understand the problem when i generate random lat and long it didnot give distance and time (reprex below)and when i mention specific lat and long it gives both(reprex also attached) please help to solve the issue.
Lat= function(){
a = runif(1,29.000000,34.000000)
return(a)
}
Long= function(){
b = runif(1,69.000000,72.000000)
return(b)
}
onlineloc=data.frame(Lat=Lat(),Long=Long())
instore=data.frame(Lat=Lat(),Long=Long())
onlineloc
#> Lat Long
#> 1 32.5422 71.29198
instore
#> Lat Long
#> 1 32.53636 71.9005
library(gmapsdistance)
results = gmapsdistance(origin = "instore", destination = "onlineloc", mode = "driving", key = "")
results
#> $Time
#> [1] NA
#>
#> $Distance
#> [1] NA
#>
#> $Status
#> [1] "PLACE_NOT_FOUND"
Created on 2020-01-23 by the reprex package (v0.3.0)
specifically mentioned both Lat and Long
library(mapsapi)
library(gmapsdistance)
results = gmapsdistance(origin = "31.713661+73.985123", destination = "33.783184+72.723076", mode = "driving", key = "")
results
#> $Time
#> [1] 13395
#>
#> $Distance
#> [1] 341800
#>
#> $Status
#> [1] "OK"
Created on 2020-01-23 by the reprex package (v0.3.0)