Skip to content

Commit

Permalink
version 0.4.9
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldorman authored and cran-robot committed Jun 13, 2021
1 parent a39eb92 commit a899eef
Show file tree
Hide file tree
Showing 8 changed files with 679 additions and 548 deletions.
12 changes: 7 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
Package: mapsapi
Type: Package
Title: 'sf'-Compatible Interface to 'Google Maps' APIs
Version: 0.4.8
Version: 0.4.9
Authors@R: c(
person("Michael", "Dorman", email = "[email protected]", role = c("aut", "cre")),
person("Tom", "Buckley", role = c("ctb")),
person("Alex", "Dannenberg", role = c("ctb")),
person("Mihir", "Bhaskar", role = c("ctb")))
person("Mihir", "Bhaskar", role = c("ctb")),
person("Juan", "P. Fonseca-Zamora", role = c("ctb")))
Description: Interface to the 'Google Maps' APIs: (1) routing directions based on the 'Directions' API, returned as 'sf' objects, either as single feature per alternative route, or a single feature per segment per alternative route; (2) travel distance or time matrices based on the 'Distance Matrix' API; (3) geocoded locations based on the 'Geocode' API, returned as 'sf' objects, either points or bounds; (4) map images using the 'Maps Static' API, returned as 'stars' objects.
License: MIT + file LICENSE
Encoding: UTF-8
Expand All @@ -20,11 +21,12 @@ URL: https://michaeldorman.github.io/mapsapi/,
https://github.com/michaeldorman/mapsapi/
BugReports: https://github.com/michaeldorman/mapsapi/issues/
NeedsCompilation: no
Packaged: 2020-12-17 12:47:10 UTC; michael
Packaged: 2021-06-13 10:30:41 UTC; michael
Author: Michael Dorman [aut, cre],
Tom Buckley [ctb],
Alex Dannenberg [ctb],
Mihir Bhaskar [ctb]
Mihir Bhaskar [ctb],
Juan P. Fonseca-Zamora [ctb]
Maintainer: Michael Dorman <[email protected]>
Repository: CRAN
Date/Publication: 2020-12-17 14:20:03 UTC
Date/Publication: 2021-06-13 10:50:02 UTC
14 changes: 7 additions & 7 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
0740b528f8cae5da53202e104bd8c038 *DESCRIPTION
ffe7abc8e48e4aefb425136212cbefa3 *DESCRIPTION
2b68ef7d4f3f35f660f181e38e70fadb *LICENSE
71e9498546359f6fcc2a120895352ddd *NAMESPACE
35abeb8e09c8b23ddc4cace0ea163926 *NEWS.md
de0df99f7b6e110b60990ed4c1b706df *NEWS.md
3de14e238fe2a1dbaf1956a6d11f6544 *R/check_inputs.R
143c8b6db613256d0e8b421f758fac8e *R/data.R
f57c78737eba06bbe1b3713268aa0786 *R/decode_line.R
70fa3d54544106ab114ebd5712d5e912 *R/encode_bounds.R
8c59d7408fe184eea35c8284c51b378b *R/encode_locations.R
528224ca66f3da66d56ec482c35ae6b8 *R/mp_directions.R
8228075c4421eb76aae3de497641874c *R/mp_directions.R
acedab4541bb77e4ab177443e76e002b *R/mp_geocode.R
40fc3a86a3699587af5bbe9363ceb296 *R/mp_get_bounds.R
04f1f984bfb7965fc37fd5f6af686010 *R/mp_get_matrix.R
bccca1232ff770e02fee4e1135ea47f8 *R/mp_get_points.R
cce0def34e62d471e2d74e0ad8621274 *R/mp_get_routes.R
1716874bf41ad3b63b438255eb54100b *R/mp_get_segments.R
064faa227675860dab9f4cefb3700f01 *R/mp_map.R
bb61d96b818b63230879bb47e2f62026 *R/mp_matrix.R
aa5dc8f91c4366f5161c48bafdecb233 *build/vignette.rds
b52532b9c007f71a81f5141a9a5b7a90 *R/mp_matrix.R
16e479c8ea5292e4c752c44951647798 *build/vignette.rds
ab13ef6f2e98c760c40e28ceb0e9559e *data/response_directions_driving.rda
8b20b9bfa22563de927db2c9a7851c24 *data/response_directions_transit.rda
d55af3c00705de4aa998afd177c4cbd2 *data/response_geocode.rda
19eb20fce52408f98c584fd032badf07 *data/response_map.rda
a3f445b454741104334ba5444772c825 *data/response_matrix.rda
feff6b46660c7525e64ce96c87ed3a11 *inst/doc/intro.R
31edb6a15bc95453a6614ede9ec40b2f *inst/doc/intro.Rmd
ed5f97922492c6e519b2a8f3171c4dcf *inst/doc/intro.html
82f7349b3690b7deff46613a38def643 *man/mp_directions.Rd
fdb01067aa4f2fbfaa0fbae37402a579 *inst/doc/intro.html
dd08e5370a05fa207d66479e0d0764ff *man/mp_directions.Rd
1b19d2282deafdb702a59a8d8c435f63 *man/mp_geocode.Rd
eac00e9696f59a692a76dc58e94f1654 *man/mp_get_bounds.Rd
1d1e8e8751ba50d06abe1692374e96ac *man/mp_get_matrix.Rd
Expand Down
7 changes: 6 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,17 @@

* 'mp_get_points' and 'mp_get_bounds' now also works given unnamed 'list' of documents

## mapsapi 0.4.8
## mapsapi 0.4.8 (2020-12-17)

* Added 'pkgdown' site
* Fixed 'mp_get_bounds' when bounds results are empty
* Fixed 'mp_get_bounds' when more than one response per address

## mapsapi 0.4.9

* Fixed bug in 'mp_matrix' (by Juan P. Fonseca-Zamora)
* New arguments in 'mp_directions' (by Juan P. Fonseca-Zamora)

## To do

* Allow selecting >1 'avoid' options in 'mp_directions'
Expand Down
24 changes: 24 additions & 0 deletions R/mp_directions.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#' @param avoid \code{NA} (default, means avoid nothing) or one of: \code{"tolls"}, \code{"highways"}, \code{"ferries"} or \code{"indoor"}
#' @param region The region code, specified as a ccTLD ("top-level domain") two-character value (e.g. \code{"es"} for Spain) (optional)
#' @param traffic_model The traffic model, one of: \code{"best_guess"} (the default), \code{"pessimistic"}, \code{"optimistic"}. The \code{traffic_model} parameter is only taken into account when \code{departure_time} is specified!
#' @param transit_mode Transit preferred mode, one or more of: \code{"bus"}, \code{"subway"}, \code{"train"} or \code{"tram"}
#' @param transit_routing_preference Transit route preference. \code{NA} (default, means no preference) or one of: \code{"less_walking"} or \code{"fewer_transfers"}
#' @param key Google APIs key
#' @param quiet Logical; suppress printing URL for Google Maps API call (e.g. to hide API key)
#' @return XML document with Google Maps Directions API response
Expand Down Expand Up @@ -95,6 +97,8 @@ mp_directions = function(
avoid = c(NA, "tolls", "highways", "ferries", "indoor"),
region = NULL,
traffic_model = c("best_guess", "pessimistic", "optimistic"),
transit_mode = c ("bus", "subway", "train", "tram"),
transit_routing_preference = c(NA, "less_walking", "fewer_transfers"),
key,
quiet = FALSE
) {
Expand All @@ -103,6 +107,8 @@ mp_directions = function(
mode = match.arg(mode)
avoid = match.arg(avoid)
traffic_model = match.arg(traffic_model)
transit_mode = match.arg(transit_mode,several.ok = TRUE)
transit_routing_preference = match.arg(transit_routing_preference)
.check_posix_time(arrival_time)
.check_posix_time(departure_time)

Expand Down Expand Up @@ -178,6 +184,24 @@ mp_directions = function(
)
}

# Add 'transit_mode'
if(mode == "transit") {
url = paste0(
url,
"&transit_mode=",
paste0(transit_mode,collapse = "|")
)

# Add 'transit_routing_preference'
if(!is.na(transit_routing_preference)) {
url = paste0(
url,
"&transit_routing_preference=",
transit_routing_preference
)
}
}

# Add key
if(!is.null(key)) {
url = paste0(
Expand Down
1 change: 1 addition & 0 deletions R/mp_matrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ mp_matrix = function(
# Checks
mode = match.arg(mode)
avoid = match.arg(avoid)
traffic_model = match.arg(traffic_model)
.check_posix_time(arrival_time)
.check_posix_time(departure_time)

Expand Down
Binary file modified build/vignette.rds
Binary file not shown.
1,163 changes: 628 additions & 535 deletions inst/doc/intro.html

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions man/mp_directions.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a899eef

Please sign in to comment.