MassHEIS
This page is a encyclopedia article.
The page identifier is Op_en5843 |
---|
Moderator:Jouni (see all) |
|
Upload data
|
Massachusetts Health and Environment Information System (MassHEIS) is a database maintained by Silent Spring Institute.
This page is a encyclopedia article.
The page identifier is Op_en5843 |
---|
Moderator:Jouni (see all) |
|
Upload data
|
Massachusetts Health and Environment Information System (MassHEIS) is a database maintained by Silent Spring Institute.
library(OpasnetUtils) library(OpasnetUtilsExt) library(ggplot2) library(rgdal) library(maptools) library(RColorBrewer) library(classInt) library(raster) library(xtable) data <- MassHEIS.data(datatable) print(xtable(head(data)), type = 'html') if(datatable == "EPAParticulateMatter") { data <- data[data$Year == year, ] title <- paste("PM2.5 concentration, annual mean in Massachusetts, ", year, " (ug /m3)", sep ="") coordinates(data)=c("longitude","latitude") # ggplot(data, aes(x = Year, y = anmean)) + geom_bar() } if(datatable == "SuperfundSites") { colnames(data)[colnames(data) == "HRS_SCORE"] <- "anmean" title <- "Superfund sites, HRS_SCORE" coordinates(data)=c("LONGITUDE","LATITUDE") } # Plot the data proj4string(data)<-("+init=epsg:4326") epsg4326String <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs") shp<-spTransform(data,epsg4326String) #Create blank raster rast<-raster() #Set raster extent to that of point data extent(rast)<-extent(shp) #Choose number of columns and rows ncol(rast) <- 64 nrow(rast) <- 64 #Rasterize point data rast2<-rasterize(shp, rast, shp$anmean, fun=mean) start <- min(shp$anmean) end <- max(shp$anmean) steps <- approx(c(start,end),n=6)$y colors <- rev(rainbow(length(steps), start=0, end=0.50)) par(mfrow=c(6,1), mar=c(3,1,0,1), cex=1.5) colorstrip <- function(colors, labels) { count <- length(colors) m <- matrix(1:count, count, 1) image(m, col=colors, ylab="", axes=FALSE) axis(1,approx(c(0, 1), n=length(labels))$y, labels) } cat("<span style='font-size: 1.2em;font-weight:bold;'>", title, "</span>\n") colorstrip(colors, steps) #Plot data google.show_raster_on_maps(rast2, col=colors, style="height:500px;") |