尝试使用 st_remove_holes 函数时出现问题
Problem trying to use st_remove_holes function
我正在尝试使用 nngeo 包中的 st_remove_holes 函数从 shapefile 中删除孔洞,但即使在 运行 它之后,一些孔洞仍然存在。
library(dplyr)
library(sf)
library(nngeo)
library(geobr)
sf_use_s2(FALSE)
shape.muni <- read_census_tract(year = 2010, code_tract = 3304557) # download the shapefile
shape.muni <- shape.muni %>%
group_by(code_neighborhood, name_neighborhood) %>%
summarise(geometry = st_union(geom)) %>%
st_remove_holes()
结果是:
enter image description here
但应该是:
enter image description here
感谢您的帮助。这解决了问题:
read_census_tract(year = 2010, code_tract = 3304557, simplified = F)
我正在尝试使用 nngeo 包中的 st_remove_holes 函数从 shapefile 中删除孔洞,但即使在 运行 它之后,一些孔洞仍然存在。
library(dplyr)
library(sf)
library(nngeo)
library(geobr)
sf_use_s2(FALSE)
shape.muni <- read_census_tract(year = 2010, code_tract = 3304557) # download the shapefile
shape.muni <- shape.muni %>%
group_by(code_neighborhood, name_neighborhood) %>%
summarise(geometry = st_union(geom)) %>%
st_remove_holes()
结果是: enter image description here
但应该是: enter image description here
感谢您的帮助。这解决了问题:
read_census_tract(year = 2010, code_tract = 3304557, simplified = F)