[R-sig-Geo] Error using unionSpatialPolygons

Roger Bivand Roger.Bivand at nhh.no
Mon Sep 3 19:47:33 CEST 2012


On Mon, 3 Sep 2012, Karl Ove Hufthammer wrote:

> Ariel Ortiz-Bobea skreiv:
>
>> I was recycling some code I used a few months ago that involved using the
>> unionSpatialPolygons() of the maptools package. Back then I didn't have a
>> problem, now I get the following error:
>> 
>>> usa_counties <- unionSpatialPolygons(usa_counties, data$fips)
>> Loading required package: rgeos
>> Loading required package: stringr
>> rgeos: (SVN revision 330)
>> GEOS runtime version: 3.3.3-CAPI-1.7.4
>> Polygon checking: TRUE
>> WARNING! if you turn polygon checking off, and polygons are
>> not valid in GEOS, you risk losing data as your R session may crash!
>> 
>> Error: TopologyException: found non-noded intersection between LINESTRING
>> (-76.0029 36.5547, -75.9398 36.5547) and LINESTRING (-75.9742 36.5261,
>> -75.9857 36.5547) at -75.985664369999995 36.55470657
>
> The data in the ‘maps’ package are probably buggy. Use the vector data from
> http://www.naturalearthdata.com/ instead. They are of great quality and 
> completely free (public domain).

The state boundaries also have issues with dangles, despite passing the 
topology checks used when the maps package installs raw boundaries.

Another source of US boundary data is the US Census:

http://www.census.gov/geo/www/cob/

Roger

>
> -- 
> Karl Ove Hufthammer
> E-mail: karl at huftis.org
> Jabber: huftis at jabber.no
>
> _______________________________________________
> 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, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no


More information about the R-sig-Geo mailing list