Making Maps with feltr


A brief introduction to the feltr package.


July 7, 2023

I make a lot of maps, almost always in R. Recently, I was introduced to It’s a clean interface for web maps, including some great features, like drawing directly on a map or adding text annotations.

The new feltr package offers an interface to the Felt API, so you can upload data to Felt directly from R. It also includes tools for reading data from Felt into R as sf objects.

You can install feltr with:


Below, I’ll demo making a map with point locations of Dunkins in Cambridge, MA, from a csv file of Dunkin addresses.

Dunkins in Cambridge, MA

First, we’ll load a few packages.

── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.2     ✔ readr     2.1.4
✔ forcats   1.0.0     ✔ stringr   1.5.0
✔ ggplot2   3.4.2     ✔ tibble    3.2.1
✔ lubridate 1.9.2     ✔ tidyr     1.3.0
✔ purrr     1.0.1     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<>) to force all conflicts to become errors
here() starts at /Users/chris/Documents/GitHub/

One of the cool things with Felt is its “Upload Anything” feature, where we can upload anything. Here, we have a csv file of addresses for every Dunkin in Cambridge. It is simple, just text addresses separated into appropriate fields.

path_dunkin_ma <- here('posts/2023-07-07-making-maps-with-feltr/dunkin_ma.csv')
read_csv(path_dunkin_ma, show_col_types = FALSE)
# A tibble: 1,062 × 5
   address           city     state zipcode    id
   <chr>             <chr>    <chr> <chr>   <dbl>
 1 147 N Quincy St   Abington MA    02351       1
 2 259 Brockton Ave  Abington MA    02351       2
 3 323 Centre Ave    Abington MA    02351       3
 4 937 Bedford St    Abington MA    02351       4
 5 100 Powdermill Rd Acton    MA    01720       5
 6 182 Great Rd      Acton    MA    01720       6
 7 212 Main St       Acton    MA    01720       7
 8 315 Main St       Acton    MA    01720       8
 9 44 Great Rd       Acton    MA    01720       9
10 150 S Main St     Acushnet MA    02743      10
# ℹ 1,052 more rows

To share this data with Felt, we first have to make a new map. We don’t have to give it any information, it’ll just make an empty map. We can pass it a title and some starting information, like where to center the map and how far to zoom.

dunk <- felt_create_map(
  title = 'Cambridge Dunkin Desert', 
  zoom = 14.5, lat = 42.3799, lon = -71.10668

Then once we have the map, we can upload the csv file directly to Felt. No local geocoding necessary, it’ll handle that. We can label the layer with name or supply colors, like fill_color and stroke_color.

layer_id <- felt_add_map_layers(
  map_id = dunk$id, name = 'Dunkin', file_names = path_dunkin_ma, 
  fill_color = '#FF671F', stroke_color = '#DA1884'

Once we do that, after a couple of minutes, we have a map. Normally it’s a few seconds if we uploaded a geojson or shp file, but geocoding takes a small bit of time.

A map of Cambridge, MA with the default Felt styling.

Default Felt Layout

What I find great about this is that I can handle all of the data work in R and then adjust the map as needed after. For example, I can annotate where the Department of Government buildings are with a green star or highlight where Darwin’s was (until recently) with a blue x.

A map of Cambridge, MA from Felt with annotations added.

Annotated Map

Clearly, Darwin’s old location would be a great place for a new Dunkin, near the middle of an existing Dunkin desert.

feltr has additional features, including:

  • deleting maps with felt_delete_map()
  • listing details of existing maps with felt_get_map() and felt_get_map_layers()
  • downloading shapes with felt_get_map_sf(), felt_get_map_geojson(), and felt_get_map_elements()
  • retrieving user details with felt_get_user().

All current features of the Felt API are supported in the CRAN version of feltr, as of July 2023. To offer feedback on feltr or ask questions, open an issue on GitHub.


BibTeX citation:
@online{t. kenny2023,
  author = {T. Kenny, Christopher},
  title = {Making {Maps} with `Feltr`},
  date = {2023-07-07},
  url = {},
  langid = {en}
For attribution, please cite this work as:
T. Kenny, Christopher. 2023. “Making Maps with `Feltr`.” July 7, 2023.