[R-sig-Geo] unionSpatialPolygons - single polygon instead of multipart polygon

hadley wickham h.wickham at gmail.com
Sun Sep 14 19:22:35 CEST 2008


On Sun, Sep 14, 2008 at 11:48 AM, Roger Bivand <Roger.Bivand at nhh.no> wrote:
> On Sun, 14 Sep 2008, hadley wickham wrote:
>
>> Hi All,
>>
>> I'm trying to figure out exactly what output unionSpatialPolygons
>> gives me - it looks like it merges my singleton polygons into
>> multi-polygons (see output of str below), but what I really want is
>> just a single singleton polygon, containing the boundary of the
>> unioned areas.  How can I get that?
>
> By defining the IDs= argument (as you do) for the output Polygons objects.
> Could you make your test file available - there may be slivers there making
> it look as though county boundaries are identical, but are separated by a
> river? See:

Ooops, I just doubled checked the input ids argument and it was in the
wrong order because the IDs were getting sorted alphabetically rather
than numerically - an as.numeric fixed the problem.  Thanks for your
help!

Hadley

-- 
http://had.co.nz/




More information about the R-sig-Geo mailing list