1

I have spatial data (about some glaciers) as an sf-object. My shp-file can be downloaded here: https://drive.google.com/open?id=1ERFdsqDGLH1a_FbxwawE_gPm0Au0Q9vT

Some of the glaciers are separated into different polygons. In the end, I want to resolve the inner boundaries and delete all polygons who are smaller than a certain cutoff (lets say 0,05km²).

So far I managed to merge adjacent polygons using st_union

glaciers <- readOGR("C:/***", "Glacier_Clip_Polygon")  
glaciers_sf <- st_as_sf(glaciers)
glaciers_combined <- st_union(glaciers_sf)

Merging them results in a Multipolygon with all inner boundaries resolved. So far so good. It now looks like this:

> glaciers_comb
Geometry set for 1 feature 
geometry type:  MULTIPOLYGON
dimension:      XY
bbox:           xmin: 81.38991 ymin: 42.47015 xmax: 81.54986 ymax: 42.57237
epsg (SRID):    4326
proj4string:    +proj=longlat +datum=WGS84 +no_defs
MULTIPOLYGON (((81.46754 42.47274, 81.46791 42....

But now I don't know how to address the polygons separately or how to delete the ones with an area smaller than my cutoff. Can anyone help me?

0

CAST them to POLYGON, giving 38 features:

> gg = st_cast(glaciers_combined,"POLYGON")
> gg
Geometry set for 38 features 
geometry type:  POLYGON
dimension:      XY
bbox:           xmin: 81.38991 ymin: 42.47015 xmax: 81.54986 ymax: 42.57237
epsg (SRID):    4326
proj4string:    +proj=longlat +datum=WGS84 +no_defs
First 5 geometries:
POLYGON ((81.46754 42.47274, 81.46791 42.47296,...
POLYGON ((81.45238 42.47778, 81.4526 42.47779, ...
POLYGON ((81.4409 42.47899, 81.44092 42.47898, ...
POLYGON ((81.41139 42.48442, 81.41071 42.48446,...
POLYGON ((81.41643 42.48445, 81.41637 42.48485,...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.