-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cartoDB basetiles #327
base: master
Are you sure you want to change the base?
Conversation
Hi @dkahle, would you have time to take a look at this PR? happy to make any required changes. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind writing some unit tests in addition to making some of the changes?
It also look like your https
parameter doesn't do anything. It should be inverted to an opt-out because we should be secure by default (I know the rest of the code doesn't do that yet, but it's a good aspiration).
#' | ||
#' @param bbox a bounding box in the format c(lowerleftlon, lowerleftlat, | ||
#' upperrightlon, upperrightlat). | ||
#' @param zoom a zoom level |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could probably use some information on format here.
#' upperrightlon, upperrightlat). | ||
#' @param zoom a zoom level | ||
#' @param maptype light_all, dark_all, light_nolabels, light_only_labels, dark_nolabels, dark_only_labels, | ||
#' rastertiles/voyager, rastertiles/voyager_nolabels, rastertiles/voyager_only_labels, or rastertiles/voyager_labels_under. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small nit: indentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also looks like the line length is different from the rest of the docstring
#' rastertiles/voyager, rastertiles/voyager_nolabels, rastertiles/voyager_only_labels, or rastertiles/voyager_labels_under. | ||
#' @param crop crop raw map tiles to specified bounding box. if FALSE, the | ||
#' resulting map will more than cover the bounding box specified. | ||
#' @param messaging turn messaging on/off |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#' @param messaging turn messaging on/off | |
#' @param messaging if FALSE, turn messaging off |
Consider also using a more standard parameter name like verbose
or silent
#' @param crop crop raw map tiles to specified bounding box. if FALSE, the | ||
#' resulting map will more than cover the bounding box specified. | ||
#' @param messaging turn messaging on/off | ||
#' @param urlonly return url only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
specify type, explain that it's the url to the map
#' resulting map will more than cover the bounding box specified. | ||
#' @param messaging turn messaging on/off | ||
#' @param urlonly return url only | ||
#' @param color color or black-and-white (use force = TRUE if you've already |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
specify type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function signature says this is an enum between color
and bw
so that should appear in the docstring.
#' @param https if TRUE, queries an https endpoint so that web traffic between | ||
#' you and the tile server is ecrypted using SSL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be an opt-out. There's no good reason not to use HTTPS when it's available.
"rastertiles/voyager_only_labels", | ||
"rastertiles/voyager_labels_under"), | ||
crop = TRUE, messaging = FALSE, urlonly = FALSE, color = c("color","bw"), force = FALSE, | ||
where = tempdir(), https = FALSE, ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HTTPS needs to be enabled by default.
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove whitespace
|
||
|
||
|
||
get_carto_tile <- function(maptype, zoom, x, y, color, force = FALSE, messaging = TRUE, where = tempdir(), https = FALSE, url){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HTTPS should be enabled by default
# the map is only a covering of the bounding box extent the idea is to get | ||
# the lower left tile and the upper right tile and compute their bounding boxes | ||
# tiles are referenced by top left of tile, starting at 0,0 | ||
# see http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https :)
Hi @scottmmjackson |
As far as tests, a simple smoke test that proves no blatant runtime errors would suffice. For the changes, the only one I really care about is inverting https and we can diverge for that. For the rest, use your judgment, but I would like types documented a little clearer. |
Adding basemap tiles from Carto DB (cleanup from now deleted pull request)
Before you open your PR
roxygen2::roxygenise(".")
?Thanks for contributing!