Title: | Read Spatial Data from Felt |
---|---|
Description: | Read Felt maps to simple feature objects in R. |
Authors: | Eli Pousson [aut, cre, cph] |
Maintainer: | Eli Pousson <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.2.9000 |
Built: | 2024-11-03 03:04:44 UTC |
Source: | https://github.com/elipousson/feltr |
Read layers from a Felt map with read_felt_layers()
, delete a single layer
with delete_felt_layer()
, update a layer with update_felt_layer()
, or
create a new layer from a URL, file, or sf or sfc object with
create_felt_layer()
. Note that reading layers does not return layer
data—only a list of layers.
create_felt_layer( map_id, layer, name = NULL, fileext = "gpkg", ..., fill_color = NULL, stroke_color = NULL, webhook_url = NULL, token = NULL ) delete_felt_layer(map_id, layer_id = NULL, safely = TRUE, token = NULL) read_felt_layers( map_id, simplifyVector = TRUE, token = NULL, call = caller_env() ) update_felt_layer( map_id, layer_id, name = NULL, description = NULL, simplifyVector = TRUE, token = NULL, call = caller_env() )
create_felt_layer( map_id, layer, name = NULL, fileext = "gpkg", ..., fill_color = NULL, stroke_color = NULL, webhook_url = NULL, token = NULL ) delete_felt_layer(map_id, layer_id = NULL, safely = TRUE, token = NULL) read_felt_layers( map_id, simplifyVector = TRUE, token = NULL, call = caller_env() ) update_felt_layer( map_id, layer_id, name = NULL, description = NULL, simplifyVector = TRUE, token = NULL, call = caller_env() )
map_id |
A Felt map URL, map ID string, or a named list with a id and
type element. If map_id is a list, it must be equivalent to the output from
|
layer |
Required. A object, file path, a layer source URL, or a |
name |
Name for new map layer. |
fileext |
File extension to use for temporary file if layer is a |
... |
Additional parameters passed to |
fill_color , stroke_color
|
Hex string to use as the layer fill or stroke color. Optional. |
webhook_url |
When the layer finishes processing, Felt will notify to this URL. |
token |
Felt personal access token |
layer_id |
Layer ID. Layer IDs for a map can be listed using
|
safely |
If |
simplifyVector |
Should JSON arrays containing only primitives (i.e. booleans, numbers, and strings) be caused to atomic vectors? |
call |
The execution environment of a currently
running function, e.g. |
description |
Map description |
A simplified data frame with a list of emojis available in Felt through the Emoji Mart picker. More information: https://github.com/missive/emoji-mart
emojis_reference
emojis_reference
A data frame with 1566 rows and 5 variables:
id
Emoji ID
name
Name
version
Version number
keywords
Keywords
alias
Alias
List the name, email address, and user ID for the Felt user associated with the default (or supplied) token.
felt_user(token = NULL)
felt_user(token = NULL)
token |
Felt personal access token |
Get comments from a Felt map as a data frame or simple feature object. The results include a comment_url column based on the comment ID value.
get_felt_comments( map_id, flatten = TRUE, geometry = TRUE, crs = NULL, simplifyVector = TRUE, token = NULL )
get_felt_comments( map_id, flatten = TRUE, geometry = TRUE, crs = NULL, simplifyVector = TRUE, token = NULL )
map_id |
A Felt map URL, map ID string, or a named list with a id and
type element. If map_id is a list, it must be equivalent to the output from
|
flatten |
If |
geometry |
If |
crs |
Coordinate reference system to return (if geometry is |
simplifyVector |
Passed to |
token |
Felt personal access token |
See Felt API documentation on the endpoint for exporting comments.
A data frame or simple feature object (with a list column of comments
if flatten is FALSE
).
get_felt_data()
returns the parsed JSON included in the body of the HTML
for a Felt map website (which includes both features and other user and layer
metadata). This data can be used to supplement the Public API and may be
deprecated as the API develops.
get_felt_data(map_id, token = NULL, call = caller_env())
get_felt_data(map_id, token = NULL, call = caller_env())
map_id |
A Felt map URL, map ID string, or a named list with a id and
type element. If map_id is a list, it must be equivalent to the output from
|
token |
Felt personal access token |
call |
The execution environment of a currently
running function, e.g. |
A list of the parsed JSON found in the "felt-data" div of a Felt map webpage.
Get one or more Felt layer styles or update a specified layer style. Warning, updating a layer style without a list that can be converted to a valid Felt Style Language (FSL) may get a layer into an irreversible broken state.
get_felt_style(map_id, layer_id = NULL, call = caller_env()) update_felt_style(map_id, style, layer_id = NULL, call = caller_env())
get_felt_style(map_id, layer_id = NULL, call = caller_env()) update_felt_style(map_id, style, layer_id = NULL, call = caller_env())
map_id |
A Felt map URL, map ID string, or a named list with a id and
type element. If map_id is a list, it must be equivalent to the output from
|
layer_id |
If |
call |
The execution environment of a currently
running function, e.g. |
style |
A named list that can be converted to a valid Felt Style
Language string. If style is supplied with a datasets id value matching the
layer datasets ids, this function updates an existing layer style. If style
is |
If layer_id is NULL
and the map contains multiple styles or if
layer_id is a character vector, the function returns a list with style
elements named with the layer ID values. If layer_id is a string, the
function returns a named list with a single Felt Style Language
specification.
Is a object a Felt URL?
is_felt_url(x) check_felt_url(x, allow_null = FALSE, arg = caller_arg(x), call = caller_env())
is_felt_url(x) check_felt_url(x, allow_null = FALSE, arg = caller_arg(x), call = caller_env())
x |
Object to check. |
allow_null |
If |
arg |
An argument name as a string. This argument will be mentioned in error messages as the input that is at the origin of a problem. |
call |
The execution environment of a currently
running function, e.g. |
Read simple features from a Felt map or get data embedded in the website of a
Felt map. Superseded by read_felt_map()
.
read_felt( url, map_id = NULL, ..., crs = 3857, token = NULL, rename = TRUE, name_repair = "check_unique" )
read_felt( url, map_id = NULL, ..., crs = 3857, token = NULL, rename = TRUE, name_repair = "check_unique" )
map_id |
A Felt map URL, map ID string, or a named list with a id and
type element. If map_id is a list, it must be equivalent to the output from
|
... |
Additional parameters passed to |
crs |
Coordinate reference system to return. Defaults to 3857. |
token |
Felt personal access token |
rename |
If |
name_repair |
Passed to repair parameter of |
A simple feature data frame.
Read elements, create, or delete a Felt map from a URL or map ID.
get_felt_map()
returns a list of map details and optionally (if read = TRUE
) adds the map elements and layer list as elements in the list.
read_felt_map(map_id, ..., crs = NULL, token = NULL) get_felt_map( map_id, ..., read = FALSE, simplifyVector = TRUE, token = NULL, call = caller_env() ) create_felt_map( title = NULL, description = NULL, location = NULL, zoom = NULL, layer_urls = NULL, basemap = c("default", "satellite"), token = NULL ) delete_felt_map(map_id, safely = TRUE, token = NULL)
read_felt_map(map_id, ..., crs = NULL, token = NULL) get_felt_map( map_id, ..., read = FALSE, simplifyVector = TRUE, token = NULL, call = caller_env() ) create_felt_map( title = NULL, description = NULL, location = NULL, zoom = NULL, layer_urls = NULL, basemap = c("default", "satellite"), token = NULL ) delete_felt_map(map_id, safely = TRUE, token = NULL)
map_id |
A Felt map URL, map ID string, or a named list with a id and
type element. If map_id is a list, it must be equivalent to the output from
|
... |
Additional parameters passed to |
crs |
Coordinate reference system. Passed to |
token |
Felt personal access token |
read |
If |
simplifyVector |
Should JSON arrays containing only primitives (i.e. booleans, numbers, and strings) be caused to atomic vectors? |
call |
The execution environment of a currently
running function, e.g. |
title |
Map title |
description |
Map description |
location |
Location to center map, either a sf, sfc, or bbox object or a
length 2 numeric vector in the form of |
zoom |
Zoom level number |
layer_urls |
A character vector or list of raster layer URLs. |
basemap |
Basemap, string ("default" or "satellite"), a valid layer URL, a color name, or a color hex code. |
safely |
If |
read_felt_map()
returns a sf object, create_felt_map()
invisibly
returns a list of attributes for the created map, and delete_felt_map()
does not return anything.
## Not run: if (interactive()) { map_data <- create_felt_map(title = "Example map") url <- map_data$attributes$url get_felt_map(url = url) delete_felt_map(url = url) read_felt_map("https://felt.com/map/Site-Plan-Example-PGTipS2mT8CYBIVlyAm9BkD") } ## End(Not run)
## Not run: if (interactive()) { map_data <- create_felt_map(title = "Example map") url <- map_data$attributes$url get_felt_map(url = url) delete_felt_map(url = url) read_felt_map("https://felt.com/map/Site-Plan-Example-PGTipS2mT8CYBIVlyAm9BkD") } ## End(Not run)
SpatRaster
object from a Felt mapRead an image feature from Felt and use the rasterpic::rasterpic_img()
function and a corresponding image URL or file path to create a SpatRaster
object based on the feature geometry.
read_felt_raster(x, images = NULL, ..., col = NULL, crs = 3857)
read_felt_raster(x, images = NULL, ..., col = NULL, crs = 3857)
x |
If x is a Felt map URL, it is passed to |
images |
A vector of image file paths or URLs with a "png", "jpeg/jpg",
or "tiff/tif" file extension. images must be ordered to match the order of
"Image" type features in the input data.frame x or have names that match
the text column for x. If images is named, any "Image" features in x with
text that does not match the names for images are excluded from the
returned list. Defaults to |
... |
Additional parameters passed to |
col |
If features in x contain an attribute with a file path or URL, set
col as the name of the attribute column. col is ignored if images is
provided. Defaults to |
crs |
Coordinate reference system to return. Defaults to 3857. |
If images is length 1, a SpatRaster
object is returned. Otherwise,
the function returns a list of SpatRaster
objects of the same length as
images.
An API personal access token is required to use read_felt()
. See
https://feltmaps.notion.site/Felt-Public-API-reference-PUBLIC-c01e0e6b0d954a678c608131b894e8e1
for instructions on how to get a token.
set_felt_token( token = NULL, install = FALSE, overwrite = FALSE, default = "FELT_ACCESS_TOKEN" ) get_felt_token( token = NULL, default = "FELT_ACCESS_TOKEN", call = caller_env() )
set_felt_token( token = NULL, install = FALSE, overwrite = FALSE, default = "FELT_ACCESS_TOKEN" ) get_felt_token( token = NULL, default = "FELT_ACCESS_TOKEN", call = caller_env() )
token |
Felt personal access token |
install |
If |
overwrite |
If |
default |
Default name used for environment variable where the token is saved. |
call |
The execution environment of a currently
running function, e.g. |