on-internet
← Community

Merge adjacent polygons in sf

Stack Overflow ·

I'm trying to merge groups of adjacent polygons, but I'm getting big multipolygons with non-adjacent areas. In the code block below plot(Matsuyama.sf) shows a large contiguous region and a few islands, but I can't extract those geometries. How do I get those areas and geometries. library(sf) library(tidyverse) Matsuyama.sf <- st_read("https://geoshape.ex.nii.ac.jp/city/geojson/20210101/38/38201A1968.geojson") Matsuyama.sf <- st_transform(Matsuyama.sf, crs=4326) plot(Matsuyama.sf) st_area(Matsuyama.sf) I can split into hundreds of polygons, but the code options below just lump them back togethe

Comments

Sign in or sign up to comment and upvote.

No comments yet.