Learn R Programming

quadkeyr

What can this package do for you?

The quadkeyr R package presents a comprehensive toolkit tailored for generating raster images from Quadkey-Identified data within Microsoft’s Bing Maps Tile System. Designed to integrate Quadkey-Identified data into R workflows, this package facilitates the creation of QuadKey grids and raster images and introduces specialized functions for the processing of Meta Mobility data, previously referred to as Facebook mobility data.

What are QuadKeys in Tile Maps?

Tile maps divide the Earth’s surface into a grid of tiles, with each tile corresponding to a specific geographic area at various zoom levels.

QuadKeys represent a location on a map by encoding its hierarchical spatial position as a sequence of characters. They provide an efficient method to address and retrieve specific map tiles, facilitating rapid display within mapping applications.


The goal of quadkeyr is to:

  1. Convert a QuadKey to a Simple Features data.frame (and more) quadkeyr provides functions to convert a QuadKey to a sf POINT data.frame or sf POLYGON data.frame. Additionally, it offers all the R functions described in the official documentation for converting QuadKeys to and from tiles, pixels, and geographic coordinates.
  1. Generate Raster Images from Quadkey-Identified Data Complete a grid of QuadKeys within a specified area and zoom level, and create a stars raster. You can also directly convert QuadKeys in a data.frame column into an sf POLYGON data.frame.
  1. Convert Meta (Facebook) Mobility QuadKey-identified Datasets into Raster Files Convert Meta (Facebook) mobility data .csv files into .tif files by day and hour reported.
  1. Offer an App for visualizing QuadKeys on a map Introduce a QuadKey visualization application enabling users to validate function outcomes.

Install quadkeyr

R-Universe

For the latest development version of quadkeyr:

install.packages("quadkeyr",
                 repos = "https://ropensci.r-universe.dev")

GitHub

You can install the development version of quadkeyr from GitHub with:

# install.packages("remotes")
remotes::install_github("ropensci/quadkeyr")

CRAN

You can install the latest version of quadkeyr from CRAN with:

install.packages("quadkeyr")

Code of Conduct

Please note that this package is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Contribute

If you’d like to contribute to this project, please follow the contributing guidelines

Links of interest

Copy Link

Version

Install

install.packages('quadkeyr')

Monthly Downloads

269

Version

0.1.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Florencia D'Andrea

Last Published

March 24th, 2025

Functions in quadkeyr (0.1.0)

mapscale

Map scale (1 : N)
mapsize

Map size in pixels
qkmap_app

Launch the Shiny App
pixelXY_to_tileXY

Convert pixel XY coordinates into tile XY coordinates
latlong_to_pixelXY

Convert lat/long coordinates to pixel XY coordinates
quadkey_to_tileXY

Convert a QuadKey into tile XY coordinates.
tileXY_to_quadkey

Convert tile XY coordinates into a QuadKey.
result_read_fb_mobility_data

Dataset with (fake) Facebook mobility data
latlong_to_quadkey

Convert latitude/longitude coordinates into QuadKeys
quadkey_to_polygon

Convert a QuadKey into a square polygon
quadkey_to_latlong

Convert a string of Quadkey numbers to lat/long coordinates
tileXY_to_pixelXY

Convert tile XY coordinates into pixel XY coordinates
quadkeyr-package

quadkeyr: Generate Raster Images from QuadKey-Identified Datasets
regular_qk_grid

Convert a incomplete QuadKey sf POINT data.frame into a regular grid.
read_fb_mobility_files

Read all the .csv files in a folder and format the data.
create_qk_grid

Create grid of QuadKeys for a particular zoom or level of detail.
get_qk_coord

Get lat/long coordinates from the QuadKey
apply_weekly_lag

Apply a 7 day lag to the variable n_crisis
data_provided

QuadKey-identified Dataset
add_regular_polygon_grid

Add the rows needed to complete a regular QuadKey polygon grid derived from the bounding box of the quadkey column of a data.frame.
get_regular_polygon_grid

Get regular QuadKey polygon grid derived from the bounding box of the quadkey column of a data.frame.
create_stars_raster

Create a stars raster
format_fb_data

Format the Facebook mobility data
grid_to_polygon

Convert a grid of QuadKeys to square polygons
ground_res

Ground resolution at a specified latitude and zoom level
polygon_to_raster

Create and save raster images for different dates and times
pixelXY_to_latlong

Convert pixel XY coordinatess into lat/long coordinates.
missing_combinations

Detect dates and hours missing in filenames
quadkey_df_to_polygon

Convert data.frame with quadkey column to a sf POLYGON data.frame