Skip to content


Repository files navigation


{placekey} is an R package to interact with the Placekey API.

See the Introduction to Placekeys vignette for more.


Some functionality of placekey requires the utilization of the C library H3 from Uber. Ensure that you have H3 installed prior to installing placekey. The instructions to install h3 can be found on the H3 GitHub repository. If you are using macOS, I recommend installing from Homebrew.

If you do not have homebrew installed, go to and follow the installation instructions. Open up spotlight search and open up the terminal application. Run brew --version to see if you have Homebrew installed. If that command doesn’t return anything un /bin/bash -c "$(curl -fsSL" to install Homebrew. Then use Homebrew to install H3.

brew install h3

Once H3 is installed, you can install placekey.


Getting placekeys from an address

To get the placekey for a place of interest (POI) you will use the get_placekey() function. To search for a placekey from an address, the arguments street_address, city, region, postal_code, and iso_country_code are required. You can optionally provide the argument location_name and strict_address_match as well as strict_name_match.


  street_address = "1543 Mission Street, Floor 3",
  city = "San Francisco",
  region  ="CA",
  postal_code = 94105,
  iso_country_code = "US"
#> [1] "226@5vg-7gq-5mk"

Alternatively, you can pass in a dataframe with column names that match required arguments. The built in dataset boston_bars is formatted as such. This method adds a new column to the provided dataframe containing the placekey.

#> [1] "22f-224@62k-phc-qs5" "22j@62k-phc-qs5"     "22c@62k-phc-qpv"    
#> [4] "229@62k-phc-qxq"

Alternatively, you can provide a named list. Doing so will create a new element called placekey which contains the placekey for the provided place. The length of the list can be greater than one.

  street_address = "1543 Mission Street, Floor 3",
  city = "San Francisco",
  region  ="CA",
  postal_code = 94105,
  iso_country_code = "US"
  ) %>% 
#> [1] "226@5vg-7gq-5mk"

Get location info from a Placekey

SafeGraph has released a Beta Places API. This gives us the ability to provide up to 100 placekeys and return their location information. Sign up for an API key on SafeGraph’s website.

bars <- c("22f-224@62k-phc-qs5", "zzw-222@62k-phc-qj9")

#> # A tibble: 2 x 6
#>   location_name  street_address city   region iso_country_code placekey         
#>   <chr>          <chr>          <chr>  <chr>  <chr>            <chr>            
#> 1 Studio 3       670 Legacy Pl  Dedham MA     US               22f-224@62k-phc-…
#> 2 Victory Grille 233 Elm St     Dedham MA     US               zzw-222@62k-phc-…

Additional usage

You can get a placekey from a coordinate.

# Get a placekey from a coordinate
(origin <- coord_to_placekey(10,10))
#> [1] "@b9f-q4k-d7r"

Placekeys can be converted to and from the H3 index.

# convert placekey to h3 index
(origin_h3 <- placekey_to_h3(origin))
#> [1] "8a58e0682d70180"

# convet h3 index back to a placekey 
#> [1] "@b9f-q4k-d7r"

Validate placekeys with is_placekey()

# Validate placekeys 
#> [1] TRUE

#> [1] FALSE


This package does not support querying latitude and longitude to the placekey API. The same functionality is provided by the coord_to_placekey() function.

The spatial capabilities are supported by H3 are limited as the two packages to interact with H3, h3r and h3, are not released on CRAN. This package adapts and limits Scott Jackson’s h3r package ( Without his concise code, this package couldn’t exist. Thank you Scott!


An R library to generate placekeys and interact with the








No releases published


No packages published