Commit 6359503b by Jan Wijffels

add as_sp

parent 572a4830
# Generated by roxygen2: do not edit by hand # Generated by roxygen2: do not edit by hand
S3method(as.data.frame,citizenair_userdata) S3method(as.data.frame,citizenair_userdata)
export(as_sp)
export(read_citizenair) export(read_citizenair)
export(read_stations) export(read_stations)
export(run_app) export(run_app)
......
...@@ -33,5 +33,20 @@ setMethod(f = "initialize", ...@@ -33,5 +33,20 @@ setMethod(f = "initialize",
}) })
#' @title TODO
#' @description TODO
#' @param object the object
#' @export
as_sp <- function(object){
if(inherits(object, "citizenair_stations")){
x <- as.data.frame(object$stations)
x <- sp::SpatialPointsDataFrame(coords = x[, c("lon", "lat")],
data = x, proj4string = CRS("+proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0"))
}else{
stop("not implemented")
}
x
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/appdata.R
\name{as_sp}
\alias{as_sp}
\title{TODO}
\usage{
as_sp(object)
}
\arguments{
\item{object}{the object}
}
\description{
TODO
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment