R中的Lon-Lat到简单功能(sfg和sfc)
如何将lon-lat点转换为简单要素(sfg),然后将其放入简单要素集合(sfc)中? 这是一个不起作用的MWE,但它是我所获得的最接近的MWE。 library(data.table) library(sf) # The DT data.table is the data I have (but 10,000s of rows, each row is a point) DT <- data.table( place=c("Finland", "Canada", "Tanzania", "Bolivia", "France"), longitude=c(27.472918, -90.476303, 34.679950, -65.691146, 4.533465), latitude=c(63.293001, 54.239631, -2.855123, -13.795272, 48.603949), crs="+proj=longlat +datum=WGS84") DT[, rowid:=1:.N] # The following two rows do …