[GIS] Add a point on a spplot in R

coordinatespointrsp

I have to add a point on a existing spplot in R. I need it only for a visual purpose. I have the coordinates of the point, but I don't know how to change the code in order to add the point.

This is the code of the spplot:

spplot(pioggiaTP[1])

And this is the map obtained by running the command:
spplot

The coordinates of the point are X=720731,8704 and Y=4861300,795 in the reference system WGS 84 / UTM zone 32N EPSG:32632, the same system of the plot.

Anyone can help me?

Best Answer

spplot returns a lattice plot of class "trellis". You can use the layer function from the latticeExtra package to update this object.

Example:

library("sp")
library("latticeExtra")

data(meuse)
data(meuse.grid)

coordinates(meuse.grid) <- ~x+y
proj4string(meuse.grid) <- CRS("+init=epsg:28992")

p <- spplot(meuse.grid, "dist")
print(p)

spplot

p + layer(panel.points(x, y, col="green", pch=19), data=meuse)

spplot update

Related Question