Hi, I have some questions about spatio temporal objects and kriging, I have done some research to try to solve this problems but I did not find any answer. I would Like to know if and, if yes, how could be possible to convert a STIDF object to a SpatialPointsDataFrame object. The second issue is if and how it could be possible to plot the map(s) obtained through the function krigeST over an open street map or a Google map layer in R environment and/or in other gis environments. Kind regards.
Spatio-Temporal objects and kriging
2 messages · Bruno Sesti, Dr. Benedikt Gräler
Dear Bruno,
On 14.06.2018 08:40, Bruno Sesti wrote:
Hi, I have some questions about spatio temporal objects and kriging, I have done some research to try to solve this problems but I did not find any answer. I would Like to know if and, if yes, how could be possible to convert a STIDF object to a SpatialPointsDataFrame object.
You can simply coerce it to "Spatial", note that the class of your
projected Spatial-Obj will depend on the class of the spatial slot of
your STIDF-Obj:
library(sp)
library(xts)
library(spacetime)
data("meuse")
coordinates(meuse) <- ~x+y
proj4string(meuse) <- CRS("+init=epsg:28992")
stidf <- STIDF(geometry(meuse), xts(1:length(meuse), Sys.time() -
(1:length(meuse))*24*3600), meuse at data)
spdf <- as(stidf, "Spatial")
spplot(spdf, "copper")
The second issue is if and how it could be possible to plot the map(s) obtained through the function krigeST over an open street map or a Google map layer in R environment and/or in other gis environments.
The function stplot re-uses the function spplot, hence you could use the
mechanisms of overlaying base maps with your interpolated values (i.e.
via sp.layout):
data(meuse.riv)
meuse.sr =
SpatialPolygons(list(Polygons(list(Polygon(meuse.riv)),"meuse.riv")))
stplot(stidf[,,"copper"], sp.layout=list("sp.polygons",
fill="lightblue", meuse.sr))
The package plotKML allows to directly plot an STIDF-Obj in Google Earth
including the temporal domain allowing for a quick animation:
library(plotKML)
plotKML(stidf)
Generally, one will have to pick an appropriate (exchange) format that
respects time and is understood by R and your favorite GIS. A slice wise
pure spatial export/plot is of course also an option, i.e. looping
through all relevant timestamps and exporting e.g. a geotiff each or
using the same techniques as in the pure spatial case.
HTH,
Ben
Kind regards. [[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Dr. Benedikt Gr?ler 52?North Initiative for Geospatial Open Source Software GmbH Martin-Luther-King-Weg 24 48155 Muenster, Germany E-Mail: b.graeler at 52north.org Fon: +49-(0)-251/396371-39 Fax: +49-(0)-251/396371-11 http://52north.org/ Twitter: @FiveTwoN General Managers: Dr. Albert Remke, Dr. Andreas Wytzisk Local Court Muenster HRB 10849