[R-sig-Geo] Fwd: dissolve tiny polygons to others with unionSpatialPolygons{maptools}

Matt Strimas-Mackey strimas at zoology.ubc.ca
Mon Jun 6 19:36:53 CEST 2016


Hi Kumar,

Based on the exchange in the thread Roger referenced I wrote a blog post
summarizing my understanding of these issue of scale and numerical
precision when performing topological operations with rgeos. It doesn't
address your issue directly, however, I think it will be of some value.
Good luck!

http://strimas.com/spatial/rgeos-scale/

M
On Jun 6, 2016 10:01 AM, "Kumar Mainali" <kpmainali at gmail.com> wrote:

> Hi Matt,
>
> You seem to have used gUnaryUnion for dissolving slivers, as I can see
> your exchanges in R listserv. Your link to your R markdown as an example of
> how to use the functions is dead. Roger responded to my question but I
> cannot find a solution. Would you mind looking at my problem and suggest
> what I should do?
>
> Thanks a lot.
>
> Regards,
> Kumar Mainali
> Postdoctoral Associate
> Department of Biology
> University of Maryland, College Park
>
> ---------- Forwarded message ----------
> From: Roger Bivand <Roger.Bivand at nhh.no>
> Date: Mon, Jun 6, 2016 at 9:24 AM
> Subject: Re: dissolve tiny polygons to others with
> unionSpatialPolygons{maptools}
> To: Kumar Mainali <kpmainali at gmail.com>
> Cc: r-help <r-help at r-project.org>, r-sig-geo at r-project.org
>
>
> On Mon, 6 Jun 2016, Kumar Mainali wrote:
>
> I am trying to use unionSpatialPolygons() of maptools to eliminate sliver
>> in species range. I want to dissolve tiny sliver polygons in a shapefile
>> to
>> bigger polygons as "Eliminate (Data Management)" of ArcMap does. Whereas I
>> can dissolve polygons that have identical features in the argument "IDs",
>> I
>> cannot dissolve tiny polygons based on some threshold in area. In fact,
>> the
>> argument "threshold" has no effect in the output.
>>
>
> Indeed, threshold is not passed through, it was used when the function
> used gpclib rather than rgeos; I'm minded to deprecate
> maptools::unionSpatialPolygons anyway. Note that the data are in
> geographical coordinates, which may very well not be appropriate for the
> topological operations you are trying to do. Use rgeos::gUnaryUnion
> instead, and refer to this thread:
>
> https://stat.ethz.ch/pipermail/r-sig-geo/2015-November/023667.html
>
> for using rgeos::set_RGEOS_polyThreshold() and friends. They do not,
> however, try to guess which of the polygons neighbouring the sliver should
> get the extra area, so you'll have to think that through yourself.
>
> Googling for lists:R-sig-geo dissolve slivers gets a fair number of hits.
>
> There is always also the upstream question of where the slivers came from,
> and whether the resolution is not in the earlier process - generate a map
> without slivers that says exactly what you mean, rather than fudging it
> afterwards.
>
> Roger
>
>
>> ​Input data is available here: ​
>> https://www.dropbox.com/sh/a0x5bbo9u60y7is/AAB6RjXHFQKZv-i-t4JclF3ba?dl=0
>>
>> p.ranges <- shapefile{raster}
>> (IDs <- p.ranges$style_id)
>> library(maptools)
>> unionSpatialPolygons(p.ranges, IDs = IDs, threshold = 1.5)
>>
>> ​-- Kumar Mainali
>> Postdoctoral Associate
>> Department of Biology
>> University of Maryland, College Park
>>
>>
>>>>
>>
> --
> 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
> http://orcid.org/0000-0003-2392-6140
> https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
> http://depsy.org/person/434412
>
>>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list