Closed szaboildi closed 3 years ago
Hi, thanks for your contribution!
I reopened the PR and:
set_rate_limit
, which now calls set_freemium
.develop
branch.Concerning the error message if freemium is deactivated and a large matrix is sent, it will return NULL
and issue the warning “403 Forbidden”, which is OK I think:
library(hereR)
set_verbose(TRUE)
library(sf)
#> Linking to GEOS 3.8.1, GDAL 3.2.1, PROJ 7.2.1
n <- 200
l <- n * n
(sf <-
data.frame(
idx = seq(1, n),
lng = runif(n, 7.5, 8.5),
lat = runif(n, 47.25, 47.75)
) %>%
st_as_sf(coords = c("lng", "lat")) %>%
st_set_crs(4326))
#> Simple feature collection with 200 features and 1 field
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: 7.501837 ymin: 47.25312 xmax: 8.497909 ymax: 47.74764
#> Geodetic CRS: WGS 84
#> First 10 features:
#> idx geometry
#> 1 1 POINT (7.651816 47.54143)
#> 2 2 POINT (8.008282 47.40666)
#> 3 3 POINT (8.434565 47.66038)
#> 4 4 POINT (8.02256 47.56635)
#> 5 5 POINT (7.504335 47.65751)
#> 6 6 POINT (7.960898 47.35633)
#> 7 7 POINT (7.622075 47.3893)
#> 8 8 POINT (8.345096 47.55927)
#> 9 9 POINT (7.709078 47.6904)
#> 10 10 POINT (8.424419 47.62594)
m1 <- route_matrix(sf)
#> Sending 28 request(s) with 1 RPS to: 'https://matrix.router.hereapi.com/v8/matrix?...'
#> Received 28 response(s) with total size: 436.7 Kb
set_freemium(FALSE)
(m2 <- route_matrix(sf))
#> Sending 1 request(s) with unlimited RPS to: 'https://matrix.router.hereapi.com/v8/matrix?...'
#> Warning in .parse_response(i, out$responses()[[i]]): Request 'id = 1' failed:
#> Status 403.
#> Received 1 response(s) with total size: 288 bytes
#> NULL
Sounds good, thank you!
Rename the rate-limit-related variable
HERE_RPS
toHERE_FREEMIUM
, and the functionshereR::set_rate_limit()
and.get_freemium()
functions tohereR::set_freemium()
and.get_freemium()
, respectively. Change the documentation to reflect the additional purpose of the nowhereR::set_freemium()
function. Use theHERE_FREEMIUM
variable to determine a plan-specific size of sub-matrices in thehereR::route_matrix()
function.