Maps

R foR Rasters

require(rgdal)
require(raster)
require(ggplot2)
require(dplyr)
require(rasterVis)

setwd("C:/DATA/Blog/raster/NLCD2011_LC_N39W072")
li <- raster("NLCD2011_LC_N39W072.tif")
plot(li)
li
shape <- readOGR(dsn = "C:/DATA/Blog/raster/lishape/government_units_NRCSCNTY_ny_3451580_01/government_units", layer = "county_nrcs_a_ny")
suffolk <- subset(shape, COUNTYNAME == "Suffolk")
plot(suffolk)
suf
suffolk_c <- crop(li, extent(suffolk))
suffolk_c2 <- mask(suffolk_c, suffolk)
suff

dist <- data.frame(freq(suffolk_c2))
g <- ggplot(dist, aes(x=X.1, y=count2, fill=X.1)) + geom_bar(stat = "identity") +
 coord_flip()

hist2
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s