Skip to content

Problem with aggregating UScensus2000 FL data

3 messages · Ista Zahn, Roger Bivand

#
Hi all,
I am trying to aggregate the UScensus data for Florida up to the zip
code level using unionSpatialPolygons from the maptools package. This
works for other states, but not for Florida:

## Works
tmp <- county(fips = gsub("^..", "",
countyfips$fips[countyfips$acronym == "fl"]), state = "fl", level =
"tract")
dat <- as.data.frame(tmp)
tmp.county <- unionSpatialPolygons(tmp, dat$county)

## Returns error
tmp <- county(fips = gsub("^..", "",
countyfips$fips[countyfips$acronym == "al"]), state = "al", level =
"tract")
dat <- as.data.frame(tmp)
tmp.county <- unionSpatialPolygons(tmp, dat$county)
Error in TopologyFunc(groupID(spgeom[ids[[i]]], id[ids[[i]]]),
names(ids)[i],  :
  TopologyException: found non-noded intersection between LINESTRING
(-0.640183 0.433522, -0.678743 0.433456) and LINESTRING (-0.678743
0.433456, -0.677839 0.434367) at -0.678743 0.433456

Does anyone have a suggestion about how to do this?

Thanks!

Ista
#
Oops, I got the examples mixed up. The Alabama example works, the
Florida example does not. I also should have given the version info,
as this may well be version specific.

R version 2.13.1 (2011-07-08)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods
[8] base

other attached packages:
 [1] rgeos_0.1-8             stringr_0.5             quadprog_1.5-4
 [4] directlabels_1.3        UScensus2000_1.00       gpclib_1.5-1
 [7] UScensus2000cdp_0.03    UScensus2000blkgrp_0.03 UScensus2000tract_0.03
[10] rgdal_0.7-1             maptools_0.8-9          lattice_0.19-30
[13] sp_0.9-84               foreign_0.8-45          ggplot2_0.8.9
[16] proto_0.3-9.2           reshape_0.8.4           plyr_1.5.2

loaded via a namespace (and not attached):
[1] digest_0.5.0 tools_2.13.1

        
On Mon, Aug 1, 2011 at 11:09 AM, Ista Zahn <izahn at psych.rochester.edu> wrote:

  
    
#
On Mon, 1 Aug 2011, Ista Zahn wrote:

            
You also need to provide the link to the data file, and the code prior to 
what you show. The function county() is not defined anywhere, 
consequently the attribute fields are nothing like tract boundaries such 
as those on:

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

The lines do intersect (touch), and should not in a topologically correct 
setting; the coordinates seem odd - what is the projection? Did you run 
checkPolygonsHoles() first?

Roger