USA
library('gcensus')
library('mapmisc')
## Loading required package: terra
## terra 1.7.55
## map images will be cached in /tmp/RtmpY2A79A/mapmiscCache
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)
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')
}