View source: R/retrieve_layers.R
get_spatial_layer | R Documentation |
This function retrieves spatial layers present in Feature Service layers of
an ArcGIS REST services API and returns them as an sf
object
get_spatial_layer(
url,
out_fields = c("*"),
where = "1=1",
token = "",
sf_type = NULL,
head = FALSE,
...
)
url |
A character string of the url for the layer to pull |
out_fields |
A character string of the fields to pull for each layer |
where |
A character string of the where condition. Default is 1=1 |
token |
A character string of the token (if needed) |
sf_type |
A character string specifying the layer geometry to convert to sf ("esriGeometryPolygon", "esriGeometryPoint", "esriGeometryPolyline"), if NULL (default) the server will take its best guess |
head |
Logical or numeric. Limits the number of records returned from a
query. If TRUE, only the first 5 records will be returned. If numeric, then
the number of records specified in |
... |
Additional arguments to pass to the ArcGIS REST POST request (or associated internal functions used to query them) |
This is one of the core functions of this package. It retrieves spatial
layers from feature services of an ArcGIS REST API designated by the URL.
Additional querying features can be passed such as a SQL WHERE statement
(where
argument) or spatial queries as well as any other types of
queries that the ArcGIS REST API accepts (using ...
). However, for
easier spatial querying see get_layers_by_spatial
.
All of the querying parameters are sent via a POST request to the URL, so
if there are issues with passing additional parameters via ...
first determine how they fit into the POST request and make adjustments as
needed. This syntax can be tricky if you're not used to it.
An object of class "sf" of the appropriate layer
## Not run:
# lava flows on Reykjanes (pr. 'rake-yah-ness') peninsula in Iceland
lava_flows <- get_spatial_layer(reykjanes_lava_flow_url)
plot_layer(lava_flows, outline_poly = reykjanes_poly)
plot_layer(lava_flows, outline_poly = iceland_poly)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.