Skip to content

Commit 117123d

Browse files
authored
Merge pull request #37 from noafterglow/patch-1
Update geocode_OSM.R to allow additional params to be passed to server
2 parents 6af9a61 + f6c994f commit 117123d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

R/geocode_OSM.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,13 @@ geocode_OSM <- function(q, projection=NULL, return.first.only=TRUE, keep.unfound
172172
#' @param projection projection in which the coordinates \code{x} and \code{y} are provided.
173173
#' @param as.data.frame return as data.frame (\code{TRUE}) or list (\code{FALSE}). By default a list, unless multiple coordinates are provided.
174174
#' @param server OpenStreetMap Nominatim server name. Could also be a local OSM Nominatim server.
175+
#' @param params Additional parameters to pass to server. (must start with &), ex: "&accept-language=en" to return english rather than local language results.
175176
#' @export
176177
#' @importFrom XML xmlChildren xmlRoot xmlAttrs xmlTreeParse xmlValue
177178
#' @return A data frame or a list with all attributes that are contained in the search result
178179
#' @example ./examples/rev_geocode_OSM.R
179180
#' @seealso \code{\link{geocode_OSM}}
180-
rev_geocode_OSM <- function(x, y=NULL, zoom=NULL, projection=4326, as.data.frame=NA, server="https://nominatim.openstreetmap.org") {
181+
rev_geocode_OSM <- function(x, y=NULL, zoom=NULL, projection=4326, as.data.frame=NA, server="https://nominatim.openstreetmap.org",params=NULL) {
181182

182183
project <- !missing(projection)
183184

@@ -224,7 +225,7 @@ rev_geocode_OSM <- function(x, y=NULL, zoom=NULL, projection=4326, as.data.frame
224225
strzoom <- paste0(", zoom = ", zoom)
225226
}
226227

227-
addr <- paste0(server, "/reverse?format=xml&lat=", lat, "&lon=", lon, qzoom, "&addressdetails=1")
228+
addr <- paste0(server, "/reverse?format=xml&lat=", lat, "&lon=", lon, qzoom, "&addressdetails=1",params)
228229

229230

230231
dfs <- lapply(1:n, function(i) {

0 commit comments

Comments
 (0)