Skip to content
Prev 28856 / 29559 Next

Mixing points and sf objects

On Thu, 3 Mar 2022, Patrick Giraudoux wrote:

            
Sorry, cannot reproduce:

library(sf)
nc <- st_read(system.file("gpkg/nc.gpkg", package="sf"))
nc_xy <- st_transform(nc, "EPSG:32019")
set.seed(1)
pts <- as.data.frame(st_coordinates(st_sample(nc_xy, 100)))

plot(pts, asp=1)
plot(st_geometry(nc_xy), add=TRUE)

and

plot(st_geometry(nc_xy))
points(pts)

seem the same. reset= is irrelevant if the plot method for sfc objects is 
used, I think it applies to sf objects only, when multiple maps may be 
displayed with keys.

Hope this helps,

Roger