| Title: | Access the Felt API |
| Version: | 0.1.0 |
| Description: | Upload, download, and edit internet maps with the Felt API (https://developers.felt.com/rest-api/getting-started). Allows users to create new maps, edit existing maps, and extract data. Provides tools for working with layers, which represent geographic data, and elements, which are interactive annotations. Spatial data accessed from the API is transformed to work with 'sf'. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.3 |
| Imports: | cli, curl, dplyr, fs, geojsonsf, httr2, jsonlite, purrr, rlang, sf, stringr, tibble, tidyr |
| URL: | https://github.com/christopherkenny/feltr, https://christophertkenny.com/feltr/ |
| Suggests: | httptest2, testthat (≥ 3.0.0) |
| Config/testthat/edition: | 3 |
| Depends: | R (≥ 4.1.0) |
| NeedsCompilation: | no |
| Packaged: | 2025-12-11 03:05:44 UTC; chris |
| Author: | Christopher T. Kenny
|
| Maintainer: | Christopher T. Kenny <ctkenny@proton.me> |
| Repository: | CRAN |
| Date/Publication: | 2025-12-11 16:20:02 UTC |
feltr: Access the Felt API
Description
Upload, download, and edit internet maps with the Felt API (https://developers.felt.com/rest-api/getting-started). Allows users to create new maps, edit existing maps, and extract data. Provides tools for working with layers, which represent geographic data, and elements, which are interactive annotations. Spatial data accessed from the API is transformed to work with 'sf'.
Author(s)
Maintainer: Christopher T. Kenny ctkenny@proton.me (ORCID)
See Also
Useful links:
Add layer to library
Description
Add layer to library
Usage
felt_add_library_layer(map_id, layer_id, name = NULL, clean = TRUE)
Arguments
map_id |
character, map identifier from url, from |
layer_id |
character, layer identifier from url, from |
name |
character, name to save the layer under. Optional. |
clean |
logical, whether to turn the API response into a tibble::tibble |
Value
a tibble::tibble if clean = TRUE, otherwise a list
Examples
felt_add_library_layer(map_id = 'TBI8sDkmQjuK2GX9CSiHiUA',
layer_id = '4Lc7RaEyRP2LfARGmR6e4C',
name = paste0('Test layer ', Sys.time()))
Add layer group to library
Description
Add layer group to library
Usage
felt_add_library_layer_group(map_id, layer_group_id, name = NULL, clean = TRUE)
Arguments
map_id |
character, map identifier from url, from |
layer_group_id |
character, layer group identifier from url, from |
name |
character, name to save the layer group under. Optional. |
clean |
logical, whether to turn the API response into a tibble::tibble |
Value
a tibble::tibble if clean = TRUE, otherwise a list
Examples
felt_add_library_layer_group(map_id = 'TBI8sDkmQjuK2GX9CSiHiUA',
layer_group_id = 'rHxyTef7S9CO8W7n1PvBVwC',
name = paste0('Test layer group ', Sys.time()))
Add Elements to Existing Map
Description
Add Elements to Existing Map
Usage
felt_add_map_elements(map_id, elements, clean = TRUE)
Arguments
map_id |
character, map identifier from url, from |
elements |
a sf::sf object or a path to a geojson file |
clean |
logical, whether to turn the API response into a tibble::tibble |
Value
a tibble::tibble with the elements added
Examples
elem <- felt_add_map_elements(map_id = 'Rockland-2024-Districts-TBI8sDkmQjuK2GX9CSiHiUA',
elements = fs::path_package('feltr', 'bbox.geojson'))
elem
# and delete layer
felt_delete_map_elements(map_id = 'TBI8sDkmQjuK2GX9CSiHiUA', element_id = elem$felt_id)
Add Layers to Existing Map
Description
Add Layers to Existing Map
Usage
felt_add_map_layers(
map_id,
name = NULL,
file_names = NULL,
lat = NULL,
lng = NULL,
zoom = NULL,
clean = TRUE
)
Arguments
map_id |
character, map identifier from url, from |
name |
Name of the layer. Required. |
file_names |
Files to include. Required. |
lat |
For images, the latitude of the center of the image. Optional. |
lng |
For images, the longitude of the center of the image. Optional. |
zoom |
For images, the zoom level of the image. Optional. |
clean |
logical, whether to turn the API response into a tibble::tibble |
Value
status of the upload
Examples
layer <- felt_add_map_layers(map_id = 'Rockland-2024-Districts-TBI8sDkmQjuK2GX9CSiHiUA',
file_names = fs::path_package('feltr', 'towns.geojson'),
name = 'Towns test')
layer
Add Layers to Existing Map from URL
Description
See Felt "Upload Anything" documentation for detailed examples of potential URLs.
Usage
felt_add_map_layers_url(map_id, url, name = NULL, clean = TRUE)
Arguments
map_id |
character, map identifier from url, from |
url |
Link to layer to include. Required |
name |
Name of the layer. Required. |
clean |
logical, whether to turn the API response into a tibble::tibble |
Value
a tibble::tibble for the created layer
Examples
# split the URL for length reasons
url <- paste0(
'https://www.rocklandgis.com/portal/sharing/rest/',
'content/items/73fc78cb0fb04580b4788937fe5ee697/data'
)
layer <- felt_add_map_layers_url(
map_id = 'Rockland-2024-Districts-TBI8sDkmQjuK2GX9CSiHiUA',
url = url,
name = 'URL Parks test')
layer
# and delete the new layer
felt_delete_map_layer(map_id = 'TBI8sDkmQjuK2GX9CSiHiUA', layer_id = layer$layer_id)
Create a new map
Description
Create a new map
Usage
felt_create_map(
title = NULL,
basemap = NULL,
layer_urls = NULL,
lat = NULL,
lon = NULL,
zoom = NULL,
description = NULL,
public_access = NULL,
clean = TRUE
)
Arguments
title |
Title to use for the map. Defaults to |
basemap |
Basemap for the new map. Defaults to |
layer_urls |
vector of URLs to generate layers in map. Defaults to |
lat |
latitude to center the map. Defaults to |
lon |
longitude to center the map. Defaults to |
zoom |
zoom level to initialize the map with. Defaults to |
description |
Description for the map legend. Defaults to |
public_access |
Degree of public acess. Defaults to |
clean |
logical, whether to turn the API response into a tibble::tibble |
Value
a tibble::tibble for the new map
Examples
map <- felt_create_map(title = 'feltr example')
map
# and delete it again
felt_delete_map(map_id = map$id)
Delete an existing map
Description
Delete an existing map
Usage
felt_delete_map(map_id)
Arguments
map_id |
character, map identifier from url, from |
Value
response code
Examples
map <- felt_create_map(title = 'feltr example')
felt_delete_map(map_id = map$id)
Delete an existing element
Description
Delete an existing element
Usage
felt_delete_map_elements(map_id, element_id)
Arguments
map_id |
character, map identifier from url, from |
element_id |
element identifier, as returned by |
Value
response code
Examples
elem <- felt_add_map_elements(map_id = 'Rockland-2024-Districts-TBI8sDkmQjuK2GX9CSiHiUA',
elements = fs::path_package('feltr', 'bbox.geojson'))
elem
# and delete layer
felt_delete_map_elements(map_id = 'TBI8sDkmQjuK2GX9CSiHiUA', element_id = elem$felt_id)
Delete Layer from an Existing Map
Description
Delete Layer from an Existing Map
Usage
felt_delete_map_layer(map_id, layer_id, clean = TRUE)
Arguments
map_id |
character, map identifier from url, from |
layer_id |
character, layer identifier from url, from |
clean |
logical, whether to turn the API response into a tibble::tibble |
Value
response code
Examples
# split the URL for length reasons
url <- paste0(
'https://www.rocklandgis.com/portal/sharing/rest/',
'content/items/73fc78cb0fb04580b4788937fe5ee697/data'
)
layer <- felt_add_map_layers_url(
map_id = 'Rockland-2024-Districts-TBI8sDkmQjuK2GX9CSiHiUA',
url = url,
name = 'URL Parks test')
layer
# and delete the new layer
felt_delete_map_layer(map_id = 'TBI8sDkmQjuK2GX9CSiHiUA', layer_id = layer$layer_id)
Export Comments on an Existing Map
Description
Export Comments on an Existing Map
Usage
felt_get_comments(map_id, clean = TRUE)
Arguments
map_id |
character, map identifier from url, from |
clean |
logical, whether to turn the API response into a tibble::tibble |
Value
a tibble::tibble for the map
Examples
felt_get_comments(map_id = 'Rockland-2024-Districts-TBI8sDkmQjuK2GX9CSiHiUA')
List all layers in your workspace library
Description
List all layers in your workspace library
Usage
felt_get_library(source = "workspace", clean = TRUE)
Arguments
source |
character, source of the layers, one of |
clean |
logical, whether to turn the API response into a tibble::tibble |
Value
a tibble::tibble if clean = TRUE, otherwise a list
Examples
felt_get_library()
Get Map Information from Map ID
Description
-
felt_get_map()returns identifying information for the map -
felt_get_map_layers()returns information about each layer in the map -
felt_get_map_elements()returns the shapes for each layer in the map
Usage
felt_get_map(map_id, clean = TRUE)
felt_get_map_layers(map_id, clean = TRUE)
felt_get_map_layer(map_id, layer_id, clean = TRUE)
Arguments
map_id |
character, map identifier from url, from |
clean |
logical, whether to turn the API response into a tibble::tibble |
layer_id |
character, layer identifier from url, from |
Value
a tibble::tibble for the map, if clean = TRUE, otherwise a list
Examples
felt_get_map('Rockland-2024-Districts-TBI8sDkmQjuK2GX9CSiHiUA')
felt_get_map_layers('Rockland-2024-Districts-TBI8sDkmQjuK2GX9CSiHiUA')
# slower, as it has to build the shapes from the API result
felt_get_map_elements('Rockland-2024-Districts-TBI8sDkmQjuK2GX9CSiHiUA')
Get Map Elements from Map ID
Description
Get Map Elements from Map ID
Usage
felt_get_map_elements(map_id, clean = TRUE)
felt_get_map_element_groups(map_id, clean = TRUE)
felt_get_map_elements_in_group(map_id, group_id, clean = TRUE)
Arguments
map_id |
character, map identifier from url, from |
clean |
logical, whether to turn the API response into a tibble::tibble |
group_id |
group identifier, as returned by |
Value
a tibble::tibble for the map
Examples
felt_get_map_elements(map_id = 'Rockland-2024-Districts-TBI8sDkmQjuK2GX9CSiHiUA')
felt_get_map_element_groups('TBI8sDkmQjuK2GX9CSiHiUA')
felt_get_map_elements_in_group('TBI8sDkmQjuK2GX9CSiHiUA', '3Wl5s2AqRmiYgO9CrBFxO3D')
Get information for a layer group
Description
Get information for a layer group
Usage
felt_get_map_layer_group(map_id, layer_group_id, clean = TRUE)
Arguments
map_id |
character, map identifier from url, from |
layer_group_id |
character, layer group identifier from url, from |
clean |
logical, whether to turn the API response into a tibble::tibble |
Value
a tibble::tibble for the layer group, if clean = TRUE, otherwise a list
Examples
felt_get_map_layer_group(
map_id = 'Rockland-2024-Districts-TBI8sDkmQjuK2GX9CSiHiUA',
layer_group_id = 'rHxyTef7S9CO8W7n1PvBVwC'
)
Obtain information about the user
Description
Obtain information about the user
Usage
felt_get_user(clean = TRUE)
Arguments
clean |
logical, whether to turn the API response into a tibble::tibble |
Value
a tibble::tibble of information about the user
Examples
felt_get_user()
Update Felt Style Information for a Layer
Description
For details on the Felt Style Language, see https://felt.com/blog/felt-style-language.
Usage
felt_patch_style(map_id, layer_id, fsl, clean = TRUE)
Arguments
map_id |
character, map identifier from url, from |
layer_id |
character, layer identifier from url, from |
fsl |
A list indicating the Felt style language to update the layer to. It must be valid FSL. |
clean |
logical, whether to turn the API response into a tibble::tibble |
Value
response data
Examples
# URL Parks layer
# read as a list
layer <- felt_get_map_layer(map_id = 'TBI8sDkmQjuK2GX9CSiHiUA',
layer_id = 'eufG5hWKRRSURHE8YcGGXA',
clean = FALSE)
# use the existing style for easiest modification
style <- layer$style
style$label$minZoom <- round(runif(1, 0, 23))
felt_patch_style(map_id = 'Rockland-2024-Districts-TBI8sDkmQjuK2GX9CSiHiUA',
layer_id = 'eufG5hWKRRSURHE8YcGGXA',
fsl = style)
Refresh an existing layer
Description
Refresh an existing layer
Usage
felt_refresh_layer(map_id, layer_id, file_names, clean = TRUE)
Arguments
map_id |
character, map identifier from url, from |
layer_id |
character, layer identifier from url, from |
file_names |
file names to upload if the original layer was created with a file upload |
clean |
logical, whether to turn the API response into a tibble::tibble |
Value
a tibble::tibble with upload information
Examples
felt_refresh_layer(map_id = 'Rockland-2024-Districts-TBI8sDkmQjuK2GX9CSiHiUA',
layer_id = 'rCfurZSFShycXHCBw69CdKB',
file_names = fs::path_package('feltr', 'towns.geojson'))
felt_refresh_layer(map_id = 'Rockland-2024-Districts-TBI8sDkmQjuK2GX9CSiHiUA',
layer_id = 'eufG5hWKRRSURHE8YcGGXA')
Update a Layer's Details
Description
Allows for updates to the name, ordering key, and subtitle.
Usage
felt_update_layer_details(
map_id,
layer_id,
layer_group_id = NULL,
name = NULL,
ordering_key = NULL,
subtitle = NULL,
clean = TRUE
)
Arguments
map_id |
character, map identifier from url, from |
layer_id |
character, layer identifier from url, from |
layer_group_id |
character, layer group identifier from url, from |
name |
Name of the layer. Defaults to |
ordering_key |
Integer to order layers. Defaults to |
subtitle |
Subtitle for the layer. Defaults to |
clean |
logical, whether to turn the API response into a tibble::tibble |
Value
response data
Examples
felt_update_layer_details(map_id = 'TBI8sDkmQjuK2GX9CSiHiUA',
layer_id = 'eufG5hWKRRSURHE8YcGGXA',
subtitle = paste0('tested ', Sys.Date()))
Update a Layer Group's Details
Description
Allows for updates to the name, ordering key, and subtitle.
Usage
felt_update_layer_group_details(
map_id,
layer_group_id,
name = NULL,
ordering_key = NULL,
subtitle = NULL,
clean = TRUE
)
Arguments
map_id |
character, map identifier from url, from |
layer_group_id |
character, layer group identifier from url, from |
name |
Name of the layer group. Required. |
ordering_key |
Integer to order by. Defaults to |
subtitle |
Subtitle for the layer group. Defaults to |
clean |
logical, whether to turn the API response into a tibble::tibble |
Value
response data
Examples
felt_update_layer_group_details(map_id = 'TBI8sDkmQjuK2GX9CSiHiUA',
layer_group_id = 'rHxyTef7S9CO8W7n1PvBVwC',
name = 'Polling Sites 2020',
subtitle = paste0('tested ', Sys.Date()))
Update a Map's Details
Description
Allows for updates to the title, description, and level of public access.
Usage
felt_update_map_details(
map_id,
title = NULL,
description = NULL,
public_access = NULL,
clean = TRUE
)
Arguments
map_id |
character, map identifier from url, from |
title |
Title to use for the map. Defaults to |
description |
Description for the map legend. Defaults to |
public_access |
Degree of public acess. Defaults to |
clean |
logical, whether to turn the API response into a tibble::tibble |
Value
response data
Examples
felt_update_map_details(map_id = 'TBI8sDkmQjuK2GX9CSiHiUA',
title = paste0('Rockland 2024 Districts, tested ', Sys.Date()))
Check or Get Felt API Key
Description
Check or Get Felt API Key
Usage
has_felt_key()
get_felt_key()
felt_get_key()
felt_has_key()
Value
logical if has, key if get
Examples
has_felt_key()
Add Entry to Renviron
Description
Adds Felt API key to .Renviron.
Usage
set_felt_key(key, overwrite = FALSE, install = FALSE, r_env = NULL)
felt_set_key(key, overwrite = FALSE, install = FALSE, r_env = NULL)
Arguments
key |
Character. API key to add to add. |
overwrite |
Defaults to FALSE. Boolean. Should existing |
install |
Defaults to FALSE. Boolean. Should this be added to an environment file, |
r_env |
Path to install to if |
Value
key, invisibly
Examples
example_env <- tempfile(fileext = '.Renviron')
set_felt_key('1234', r_env = example_env)
# r_env should likely be: file.path(Sys.getenv('HOME'), '.Renviron')