USA

library('gcensus')
library('mapmisc')
## Loading required package: sp
## Loading required package: raster
## map images will be cached in  /tmp/mapmiscCache_rforge
usa = try(gcensus(country = "USA", 
        year = 2000, level = 4, 
        subset = c(name1='Maine'),
        database = c(dbname = "gcensus", user = "gcensus", 
                host = "localhost", port = 5433), 
        income = TRUE, t_srs = "EPSG:3463", simplifyTolerance = 0), silent=TRUE)
## Warning: running command '"/usr/bin/ogr2ogr" -simplify "0" -where "name1
## like 'Maine'" -t_srs "EPSG:3463" "/tmp/Rtmp3GrK3Z/file79997024dac6.shp"
## "PG: dbname = gcensus user = gcensus host = localhost port = 5433"
## "usa2000.l4map"' had status 1
if(class(usa) != 'try-error') {
bgMap = openmap(usa, path='waze-us', maxTiles=20)
myCol = colourScale(usa$median_hou, 
        breaks=9, col='Reds',
        opacity=c(0.5, 1), dec=-3)
map.new(usa)
plotRGB(bgMap, add=TRUE)
plot(usa, add=TRUE, col=myCol$plot)
legendBreaks("right", myCol)
scaleBar(usa,'topright')
}