data(fires)
fires$X <- fires$X*100000
fires$Y <- fires$Y*100000
library(sp)
coordinates(fires) <- c("X", "Y")
proj4string(fires) <- CRS("+init=epsg:2229 +ellps=GRS80")
dates <- as.Date("1960-01-01")+(fires$Time-1)
Fires <- STIDF(as(fires, "SpatialPoints"), dates, data.frame(time=fires$Time))
library(mapdata)
if (require(sf)) {
m <- map("county", "california", xlim=c(-119.1, -117.5),
ylim=c(33.7, 35.0), plot=FALSE, fill=TRUE)
m.sf <- st_transform(st_as_sfc(m), "EPSG:2229")
cc <- as(m.sf, "Spatial")
plot(cc, xlim=c(6300000, 6670000), ylim=c(1740000, 2120000))
plot(slot(Fires, "sp"), pch=3, add=TRUE)
stplot(Fires, sp.layout=list("sp.lines", cc))
}
Run the code above in your browser using DataLab