[R-sig-Geo] Mixing points and sf objects
p@tr|ck@g|r@udoux @end|ng |rom un|v-|comte@|r
Thu Mar 3 11:47:12 CET 2022
After some trials off list with Roger, it appears that the underlying
problem was that chbrut[,5:6] are character columns, which need to be
converted to numeric first.
Ashes on my head, a looked for complicated things where the issue was at
hand for a R early beginner...
Sorry to have polluted the list with such a trivial issue...
Le 03/03/2022 à 10:32, Roger Bivand a écrit :
> On Thu, 3 Mar 2022, Patrick Giraudoux wrote:
>> Dear listers,
>> Just for curiosity, using one sf object (depts) and one classical
>> data.frame with two columns bearing coordinates, I wonder why this
>> sequence works (points and department limits are correctly drawn):
>> .. but not this one (points of chbrut are not projected - or projected
>> somewhere else, and are not visible on the map)
> Sorry, cannot reproduce:
> nc <- st_read(system.file("gpkg/nc.gpkg", package="sf"))
> nc_xy <- st_transform(nc, "EPSG:32019")
> pts <- as.data.frame(st_coordinates(st_sample(nc_xy, 100)))
> plot(pts, asp=1)
> plot(st_geometry(nc_xy), add=TRUE)
> 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,
>> [[alternative HTML version deleted]]
>> R-sig-Geo mailing list
>> R-sig-Geo using r-project.org
[[alternative HTML version deleted]]
More information about the R-sig-Geo