# if(!require(devtools)){install.packages(devtools)} # devtools::install_github("talbertc-usgs/nabatr") # library(nabatr) # OR source('../R/get_nabat_grts.R') if(!require(devtools)){install.packages(devtools)} devtools::install_github("ennsk/nabatr") print ('test for dev branch')
library(sp)
colorado = get_grts_data('conus', query="state_n_1='Colorado'")
ylgn <- colorRampPalette(c('palegoldenrod', 'forestgreen')) spplot(colorado, zcol='own_USFS', col.regions = ylgn(100))
dim(colorado)
grts_id = 381 current_site = subset(colorado, colorado$GRTS_ID == grts_id) lat = current_site$lat lon = current_site$long print (paste0('GRTS ID: ', grts_id)) print (paste0('Latitude: ', lat)) print (paste0('Longitude: ', lon))
colorado_priority = get_grts_data('Conus', query="state_n_1='Colorado'", only_priority = T)
cutoff_pcnt = 3 usfs_cells = colorado[colorado$own_USFS >= 50, ] usfs_priority_cells = usfs_cells[usfs_cells$GRTS_ID <= quantile(colorado$GRTS_ID, prob=cutoff_pcnt/100),]
library(ggplot2) library(ggmap) library(maps) library(mapdata)
states <- map_data("state") counties <- map_data("county") co_df <- subset(states, region == "colorado") co_county <- subset(counties, region == "colorado")
co_base <- ggplot(data = co_df, mapping = aes(x = long, y = lat, group = group)) + coord_fixed(1.3) + geom_polygon(color = "black", fill = "gray")
library(repr) options(repr.plot.width=10, repr.plot.height=8) co_base + geom_polygon(data=spTransform(usfs_cells, CRS("+proj=longlat +datum=WGS84")), color='grey30', fill='red', alpha=0.0) + geom_polygon(data=spTransform(colorado_priority, CRS("+proj=longlat +datum=WGS84")), color='red', fill='red', alpha=0.5) + geom_polygon(data=spTransform(usfs_priority_cells, CRS("+proj=longlat +datum=WGS84")), color='forestgreen', fill='green', alpha=0.0, size=1) + geom_polygon(data = co_county, fill = NA, color = "white") + geom_polygon(color = "black", fill = NA) + ggtitle("Colorado USFS GRTS Priority Cells in Colorado")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.