R/proj4web.R

Defines functions proj4web

Documented in proj4web

#' Project for web function
#'
#' This function allows you to reproject spatial data to WGS84, which is the projection required for webmaps such as leaflet.js
#'
#' You can either use the default WGS84 projection or supply your own.
#'
#' @param dat Expects input of sp object: point, polygon, etc.
#' @param projection Defaults to WGS84
#' @keywords ggplot NZ maps
#' @examples
#' webprojected <- proj4web(anyprojection)
#' @import rgdal
#' @import sp
#' @import mapproj
#' @export

proj4web <- function(dat, projection = '+proj=longlat +datum=WGS84'){
  require(sp)
  spTransform(dat, CRS(projection))
}
isaacbain/spatinz documentation built on May 23, 2019, 7:33 a.m.