Available maps

While snappoly is a data package, it does contain one helper function that prints out a simply summary of all the available data sets in the package along with some basic metadata. If you are new to the package or just need a quick reminder of what data you were using previously, this is a convenient way to get started.

library(snappoly)
snappolys()
#> # A tibble: 8 x 7
#>   data   domain features variables id     multilevel description          
#>   <chr>  <chr>     <int>     <int> <chr>  <lgl>      <chr>                
#> 1 alaska ak            1         2 <NA>   FALSE      Domain mask          
#> 2 canada akcan        13         5 NAME   FALSE      Domain mask          
#> 3 ecoreg ak           32         8 COMMO~ TRUE       Alaska ecological re~
#> 4 aklcc  ak            5         6 LCC_N~ FALSE      Landscape Conservati~
#> 5 lcc    akcan         5         3 LCC_N~ FALSE      Landscape Conservati~
#> 6 cavm   ak            3         4 Name   TRUE       Alaska circumpolar a~
#> 7 fmz    ak           14         5 REGION FALSE      Alaska Fire Service ~
#> 8 tpa    akcan         8         5 MGT_A~ FALSE      Alaska/Canada terres~

Plot

TO create a basic plot, coloring in different polygons, it is not necessary to explicitly load any additional packages.

clrs <- c("#FC8D62", "#8DA0CB", "#E78AC3", "#A6D854", "#FFD92F")
plot(aklcc, col = clrs, border = NA)

Additional information

While the raster package is loaded, use some other functions on the Alaska LCC data set.

In addition to extent, the functions xmin, xmax, ymin and ymax are available for individual boundary values. The Alaska Albers equal area conic projection is shared across all data sets in snappoly. This is also consistent with data sets in the snapgrid package.

Rasterize polygons

If you want to rasterize polygons from snappoly it can be as simple as rasterizing a map using its own extent.

You will likely want to provide additional arguments to raster than just the extent, such as nrows and ncols, or resolution. Otherwise the resulting raster will default to 180 rows by 360 columns with interpolated x and y cell resolutions. Another option is to rasterize polygons from snappoly based on a raster layer from the snapgrid package if you want to work with them together in the same format. For example, rasterize the AK LCC polygons using the Alaska ALFRESCO spatial flammability domain, as utilized by the JFSP project and others. Then mask to this domain.

library(snapgrid)
r <- mask(rasterize(aklcc, swflam), swflam)
plot(r, col = clrs)

The snapgrid package is also recommended. Data sets included there are not duplicated in vectorized form here. These two packages compliment one another and each offers data sets that are most commonly utilized at SNAP in the respective vector or raster format. For a similar introduction to snapgrid, see the corresponding vignette to get started.