arc_read | R Documentation |
arc_read()
combines the functionality of arc_open()
with arc_select()
or arc_raster()
to read an ArcGIS FeatureLayer
, Table
, or ImageServer
to an sf
or SpatRaster
object. Optionally, set, check, or modify names
for the returned data frame or sf object using the col_names
and
name_repair
parameters. For ease of use and convenience, arc_read()
allows users to access and query a FeatureLayer, Table, or ImageServer with a
single function call instead of combining arc_open()
and arc_select()
.
The conventions of col_select
are based on functions for reading tabular
data in the {readr}
package.
arc_read(
url,
col_names = TRUE,
col_select = NULL,
n_max = Inf,
name_repair = "unique",
crs = NULL,
...,
fields = NULL,
alias = c("drop", "label", "replace"),
token = arc_token()
)
url |
The url of the remote resource. Must be of length one. |
col_names |
Default
|
col_select |
Default |
n_max |
Defaults to |
name_repair |
Default |
crs |
the spatial reference to be returned. If the CRS is different than
the CRS for the input |
... |
Additional arguments passed to |
fields |
Default |
alias |
Use of field alias values. Default
|
token |
your authorization token. |
An sf object, a data.frame
, or an object of class SpatRaster
.
arc_select()
; arc_raster()
## Not run:
furl <- "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3"
# read entire service
arc_read(furl)
# apply tolower() to column names
arc_read(url, name_repair = tolower)
# use paste0 to prevent CRAN check NOTE
furl <- paste0(
"https://sampleserver6.arcgisonline.com/arcgis/rest/services/",
"EmergencyFacilities/FeatureServer/0"
)
# use field aliases as column names
arc_read(furl, col_names = "alias")
# read an ImageServer directly
img_url <- "https://landsat2.arcgis.com/arcgis/rest/services/Landsat/MS/ImageServer"
arc_read(
img_url,
width = 100, height = 100,
xmin = -71, ymin = 43,
xmax = -67, ymax = 47.5,
bbox_crs = 4326
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.