[R-sig-Geo] Cleaning small spatial polygons
Eduardo Diez
eduardodiez at gmx.com
Mon Oct 19 20:03:07 CEST 2015
Ok. So here's a link to a zip file that contains two shapefiles:
- pol_to_be_cleaned: the layer from which i'd like to remove small polygons
- pol_cleaned: the layer cleaned with the function v.clean rmarea
http://1drv.ms/1GmRWS7
The threshold i used for cleaning was 3000 (meaning 3000 squared meters).
Although i do project it before sending it to GRASS, according to the
official help page it should be able to handle it:
"Threshold must always be in square meters, also for latitude-longitude
locations or locations with units other than meters"
Thanks
2015-10-19 8:28 GMT-03:00 Roger Bivand <Roger.Bivand at nhh.no>:
> 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
>
>
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list