R/map_advcal.R

Defines functions map_advcal

#' Title
#'
#' @param x
#'
#' @return
#' @export
#'
#' @examples
map_advcal = function(x){

  x = data.frame("adr" = c("Hofreuthackerstr. 6, 90482, Nürnberg",
                           "Zaunwiesenweg 2a, 90482, Nürnberg"),
                 stringsAsFactors = FALSE)

  x_gc = map_df(.x = x$adr,
                .f = function(x) {

                  # x = x$adr[1]
                  gc = opencage::opencage_forward(placename = x,
                                                  limit = 1,
                                                  key = "32c2600a4f444f1788b87082e82581f2")

                  return(gc$results[, c("geometry.lng", "geometry.lat")])



                })

  x_gc = cbind(x, x_gc)

  m = x_gc %>%
    sf::st_as_sf(coords = c("geometry.lng", "geometry.lat"), crs = 4326) %>%
    mapview::mapview()


}
hewag1975/foRthefun documentation built on Dec. 23, 2019, 7:36 p.m.