我有一些多边形数据作为一个csv文件与此格式:
"ID","name","geometry"
"1","A","list(c(-0.25291548373789, -0.251828087559847, -0.251065989114876, -0.24944850900495, 51.4652163826438, 51.4652280432439, 51.4652040920587, 51.4650720752044))"
"2","B","list(c(-0.26291548373789, -0.211828087559847, -0.231065989114876, -0.26944850900495, 51.1652163826438, 51.2652280432439, 51.3652040920587, 51.5650720752044))"
当我把它导入Rstudio时,它看起来像这样:
这正是我想要的,但数据类型不是我需要的:
$ ID : num [1:2] 1 2
$ name : chr [1:2] "A" "B"
$ geometry: chr [1:2] ""list(c(-0.25291548373789, -0.2518280875598..."
我所需要的是这个几何列的空间对象作为多边形,能够使用它的传单作为:
addPolygons(data=test$geometry)
有什么想法如何实现这一点?
谢谢!
1条答案
按热度按时间2wnc66cl1#
测试〈- st_as_sf(测试,wkt =“几何图形”)