Skip to content

Commit 6ae4546

Browse files
committed
add raster-fn qmd
1 parent d03b2f5 commit 6ae4546

File tree

2 files changed

+67
-1
lines changed

2 files changed

+67
-1
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
*.html
12
_api_ref.*
23
_api_ref/
34
_arcgis/
@@ -10,4 +11,5 @@ _site/
1011
/.quarto/
1112
.RData
1213
.Rhistory
13-
.Rproj
14+
.Rproj
15+
**/*_files/

docs/layers/raster-fn.qmd

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
title: "Using Raster Functions"
3+
uid: raster-fns
4+
---
5+
6+
Raster functions are server-side operations that can be applied to imagery and raster data to perform analysis, visualization, and data transformation. These functions are made available through ArcGIS ImageServers and allow you to process raster data dynamically without downloading large datasets to your local machine.
7+
8+
In this tutorial, we'll demonstrate how to discover and apply raster functions using the [Forest Service FIA BIGMAP Tree Species Aboveground Biomass](https://data.fs.usda.gov/geodata/rastergateway/bigmap/index.php) dataset, which represents estimates in tons per acre for total aboveground biomass as well as that of 327 individual tree species at a 30 meter pixel spatial resolution within the coterminous United States.
9+
10+
```{r include = FALSE}
11+
library(pillar)
12+
```
13+
14+
## Connecting to an ImageServer
15+
16+
First, we'll establish a connection to the ImageServer containing our biomass data:
17+
18+
```{r, message =FALSE}
19+
library(arcgis)
20+
21+
# Store the ImageServer URL
22+
tree_species_biomass <- "https://di-usfsdata.img.arcgis.com/arcgis/rest/services/FIA_BIGMAP_2018_Tree_Species_Aboveground_Biomass/ImageServer"
23+
24+
# Create a connection to the ImageServer
25+
srvr <- arc_open(tree_species_biomass)
26+
srvr
27+
```
28+
29+
## Discovering Available Raster Functions
30+
31+
Once connected, we can explore what raster functions are available on this ImageServer:
32+
33+
```{r}
34+
# List all raster functions available in the ImageServer
35+
raster_fns <- list_raster_fns(srvr)
36+
raster_fns
37+
```
38+
39+
The `list_raster_fns()` function returns a data frame containing all available raster functions. Each function corresponds to a different tree species or analysis type available in the dataset.
40+
41+
## Applying Raster Functions
42+
43+
To apply a raster function, specify its name in the `raster_fn` argument when calling `arc_raster()`. Here we'll extract biomass data for Balsam Fir trees in a specific geographic area:
44+
45+
```{r}
46+
# Fetch data with the Balsam Fir raster function applied
47+
res <- arc_raster(
48+
srvr,
49+
xmin = -71,
50+
xmax = -67,
51+
ymin = 43,
52+
ymax = 47.5,
53+
bbox_crs = 4326,
54+
width = 1000,
55+
height = 1000,
56+
raster_fn = "SPCD_0012_Abies_balsamea"
57+
)
58+
59+
# Visualize the results
60+
terra::plot(res)
61+
```
62+
63+
The resulting `SpatRaster` object contains the processed biomass values for Balsam Fir trees in our specified extent. The raster function has been applied server-side, returning only the processed data we need for analysis.
64+

0 commit comments

Comments
 (0)