[R-sig-Geo] Cleaning small spatial polygons

Roger Bivand Roger.Bivand at nhh.no
Mon Oct 19 13:28:24 CEST 2015


On Fri, 16 Oct 2015, Eduardo Diez wrote:

> Dear list,
> I'm willing to know if any knows a way of performing tha same thing i'm
> doing through rgrass7 with GRASS when I execute the function v.clean with
> "rmarea" as the tool argument. That is:
>
> "The rmarea tool removes all areas <= thresh. The longest boundary with an
> adjacent area is removed or all boundaries if there is no adjacent area.
> Area categories are not combined when a small area is merged with a larger
> area."
>
> Basically i have raster of zones within a field. I convert it to
> SpatialPolygonsDataFrame and in order to leave only the more
> important/meaningful ones i remove the small/sliver with this tool. In
> general it works fine but having to call an external software with a
> specific version makes the script less portable and you have to be careful
> with updates and such. Also you have to write rasters and shapefiles back
> and forth as GRASS can't work with in-memory objects.

Could you please provide an example of a built-in or contributed data set 
(URL, not attachment) with the slivers you mention, so that we know that 
we are addressing your problem? I don't think that:

https://cran.r-project.org/web/packages/cleangeo/index.html

does this, as it seems to try to repair broken geometries.

Also note that you need to specify that the area threshold is in a square 
planar metric - dropping slivers in unprojected geometries may be more 
complicated.

Roger

>
> Does someone know a way of doing this in plain R?
>
> Thanks
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 91 00
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list