maptiles

Download, compose and display map tiles with R

https://github.com/riatelab/maptiles

Science Score: 62.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    2 of 7 committers (28.6%) from academic institutions
  • Institutional organization owner
    Organization riatelab has institutional domain (riate.cnrs.fr)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (18.3%) to scientific vocabulary

Keywords

map r rspatial tiles

Keywords from Contributors

cartography
Last synced: 4 months ago · JSON representation ·

Repository

Download, compose and display map tiles with R

Basic Info
  • Host: GitHub
  • Owner: riatelab
  • Language: R
  • Default Branch: main
  • Homepage:
  • Size: 24.6 MB
Statistics
  • Stars: 109
  • Watchers: 6
  • Forks: 11
  • Open Issues: 0
  • Releases: 7
Topics
map r rspatial tiles
Created about 5 years ago · Last pushed 8 months ago
Metadata Files
Readme Changelog Citation Codemeta

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
knitr::knit_hooks$set(margin = function(before, options, envir) {
  if (before) {
    par(mar = c(0, 0, 0, 0))
  }
})
```

# maptiles 


[![R-CMD-check](https://github.com/riatelab/maptiles/actions/workflows/check-standard.yaml/badge.svg)](https://github.com/riatelab/maptiles/actions/workflows/check-standard.yaml)
[![Codecov test coverage](https://codecov.io/gh/riatelab/maptiles/branch/main/graph/badge.svg)](https://app.codecov.io/gh/riatelab/maptiles?branch=main)
[![CRAN status](https://www.r-pkg.org/badges/version/maptiles)](https://CRAN.R-project.org/package=maptiles)
![](https://cranlogs.r-pkg.org/badges/maptiles)
[![Project Status: Active – The project has reached a stable, usable
state and is being actively
developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)


To create maps from tiles, `maptiles` downloads, composes and displays tiles 
from a large number of providers (e.g. OpenStreetMap, Stadia, Esri, CARTO, or 
Thunderforest). 

## Installation

You can install the released version of `maptiles` from [CRAN](https://CRAN.R-project.org/package=maptiles) with:

``` r
install.packages("maptiles")
```

You can install the development version of `maptiles` from GitHub with:

``` r
# install.packages("remotes")
remotes::install_github("riatelab/maptiles")
```

## Demo

This is a basic example which shows you how to dowload and display OpenStreetMap 
tiles over North Carolina:


```{r example, fig.ext="png", margin = TRUE, fig.width=808/96, fig.height = 303/96, dpi = 96, fig.show='hide'}
library(sf)
library(maptiles)
# import North Carolina counties
nc_raw <- st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
# Project to EPSG:3857
nc <- st_transform(nc_raw, "EPSG:3857")
# dowload tiles and compose raster (SpatRaster)
nc_osm <- get_tiles(nc, crop = TRUE)
# display map
plot_tiles(nc_osm)
# add Norh Carolina counties
plot(st_geometry(nc), col = NA, add = TRUE)
# add credit
mtext(text = get_credit("OpenStreetMap"), side = 1, line = -1, adj = .99)
```

![](man/figures/README-example-1.png)


`maptiles` gives access to a lot of tiles servers, but it is possible to 
add others. The following example demonstrates the setting of a map tiles server
and how to cache the original tiles for future use:


```{r example2,fig.ext="png", margin = TRUE, fig.width=1615/96, fig.height = 605/96, fig.show='hide', dpi = 96}
# define the tile server parameters
osmpos <- create_provider(
  name = "CARTO.POSITRON",
  url = "https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png",
  sub = c("a", "b", "c", "d"),
  citation = "© OpenStreetMap contributors © CARTO "
)
# dowload tiles and compose raster (SpatRaster)
nc_osmpos <- get_tiles(
  x = nc, provider = osmpos, crop = TRUE,
  cachedir = tempdir(), verbose = TRUE, retina = TRUE
)
# display map
plot_tiles(nc_osmpos)
# display credits
mtext(text = get_credit(osmpos), side = 1, line = -1, adj = .99)
```

![](man/figures/README-example2-1.png)

The following figure shows mini maps for most of the tiles providers available:

![](man/figures/README-front.png)


## Projection

Original tiles use a projection known as "Web Mercator", 
"WGS84 / Pseudo Mercator", "Google Mercator", "EPSG:3857" or "EPSG:900913". 
In most cases `get_tiles()` uses the projection of its `x` argument to 
reproject the tiles. If you wish to avoid any deformation induced by the 
reprojection process, use "EPSG:3857" for `x` projection.

## Attribution of map tiles

All maps available through `maptiles` are offered freely by various providers. 
The only counterpart from the user is to properly display an attribution text 
on the maps. 
`get_credit()` displays a short attribution text to add on each map 
using the downloaded tiles. 

## Alternatives

There are many alternative packages that pursue the same objective as 
`maptiles`. Some focus on a specific map tiles provider (e.g. Mapbox, Google, 
OpenStreetMap) or on a specific graphics device (`ggplot2`). The goal of `maptiles` 
is to be flexible enough to allow the use of different providers and to have a 
minimal number of robust and modern dependencies.
However, depending on the use case, one of following packages may better 
suit your needs:  

* [`ceramic`](https://github.com/hypertidy/ceramic)  
* [`ggmap`](https://github.com/dkahle/ggmap) (`ggplot2` focused)
* [`ggspatial`](https://github.com/paleolimbot/ggspatial) (`ggplot2` focused, based on `rosm`)
* [`mapboxapi`](https://github.com/walkerke/mapboxapi) (mapbox)
* [`mapsapi`](https://github.com/michaeldorman/mapsapi/) (google, based on `RgoogleMaps`)
* [`OpenStreetMap`](https://github.com/ifellows/ROSM) (requires Java)
* [`RgoogleMaps`](https://github.com/markusloecher/rgooglemaps) (google)
* [`rosm`](https://github.com/paleolimbot/rosm)
* ...

## Note

Not to be confused with [`tilemaps`](https://github.com/kaerosen/tilemaps), that "implements an algorithm for generating maps, known as tile maps, in which each region is represented by a single tile of the same shape and size."

Owner

  • Name: riatelab
  • Login: riatelab
  • Kind: organization
  • Location: Paris

Spatial analysis and mapping software packages created by the Center for Spatial Analysis and Geovisualization - RIATE

Citation (CITATION.cff)

# --------------------------------------------
# CITATION file created with {cffr} R package
# See also: https://docs.ropensci.org/cffr/
# --------------------------------------------
 
cff-version: 1.2.0
message: 'To cite package "maptiles" in publications use:'
type: software
license: GPL-3.0-only
title: 'maptiles: Download and Display Map Tiles'
version: 0.10.0
doi: 10.32614/CRAN.package.maptiles
abstract: To create maps from tiles, 'maptiles' downloads, composes and displays tiles
  from a large number of providers (e.g. 'OpenStreetMap', 'Stadia', 'Esri', 'CARTO',
  or 'Thunderforest').
authors:
- family-names: Giraud
  given-names: Timothée
  email: timothee.giraud@cnrs.fr
  orcid: https://orcid.org/0000-0002-1932-3323
repository: https://CRAN.R-project.org/package=maptiles
repository-code: https://github.com/riatelab/maptiles/issues/
url: https://github.com/riatelab/maptiles/
contact:
- family-names: Giraud
  given-names: Timothée
  email: timothee.giraud@cnrs.fr
  orcid: https://orcid.org/0000-0002-1932-3323
references:
- type: software
  title: 'R: A Language and Environment for Statistical Computing'
  notes: Depends
  url: https://www.R-project.org/
  authors:
  - name: R Core Team
  institution:
    name: R Foundation for Statistical Computing
    address: Vienna, Austria
  year: '2025'
  version: '>= 3.5.0'
- type: software
  title: sf
  abstract: 'sf: Simple Features for R'
  notes: Imports
  url: https://r-spatial.github.io/sf/
  repository: https://CRAN.R-project.org/package=sf
  authors:
  - family-names: Pebesma
    given-names: Edzer
    email: edzer.pebesma@uni-muenster.de
    orcid: https://orcid.org/0000-0001-8049-7069
  year: '2025'
  doi: 10.32614/CRAN.package.sf
- type: software
  title: curl
  abstract: 'curl: A Modern and Flexible Web Client for R'
  notes: Imports
  url: https://jeroen.r-universe.dev/curl
  repository: https://CRAN.R-project.org/package=curl
  authors:
  - family-names: Ooms
    given-names: Jeroen
    email: jeroenooms@gmail.com
    orcid: https://orcid.org/0000-0002-4035-0289
  year: '2025'
  doi: 10.32614/CRAN.package.curl
- type: software
  title: digest
  abstract: 'digest: Create Compact Hash Digests of R Objects'
  notes: Imports
  url: https://dirk.eddelbuettel.com/code/digest.html
  repository: https://CRAN.R-project.org/package=digest
  authors:
  - family-names: Eddelbuettel
    given-names: Dirk
    email: edd@debian.org
    orcid: https://orcid.org/0000-0001-6419-907X
  year: '2025'
  doi: 10.32614/CRAN.package.digest
- type: software
  title: graphics
  abstract: 'R: A Language and Environment for Statistical Computing'
  notes: Imports
  authors:
  - name: R Core Team
  institution:
    name: R Foundation for Statistical Computing
    address: Vienna, Austria
  year: '2025'
- type: software
  title: grDevices
  abstract: 'R: A Language and Environment for Statistical Computing'
  notes: Imports
  authors:
  - name: R Core Team
  institution:
    name: R Foundation for Statistical Computing
    address: Vienna, Austria
  year: '2025'
- type: software
  title: png
  abstract: 'png: Read and write PNG images'
  notes: Imports
  url: http://www.rforge.net/png/
  repository: https://CRAN.R-project.org/package=png
  authors:
  - family-names: Urbanek
    given-names: Simon
    email: Simon.Urbanek@r-project.org
  year: '2025'
  doi: 10.32614/CRAN.package.png
- type: software
  title: terra
  abstract: 'terra: Spatial Data Analysis'
  notes: Imports
  url: https://rspatial.org/
  repository: https://CRAN.R-project.org/package=terra
  authors:
  - family-names: Hijmans
    given-names: Robert J.
    email: r.hijmans@gmail.com
    orcid: https://orcid.org/0000-0001-5872-2872
  year: '2025'
  doi: 10.32614/CRAN.package.terra
  version: '>= 1.8-21'
- type: software
  title: tools
  abstract: 'R: A Language and Environment for Statistical Computing'
  notes: Imports
  authors:
  - name: R Core Team
  institution:
    name: R Foundation for Statistical Computing
    address: Vienna, Austria
  year: '2025'
- type: software
  title: slippymath
  abstract: 'slippymath: Slippy Map Tile Tools'
  notes: Imports
  url: https://www.github.com/milesmcbain/slippymath
  repository: https://CRAN.R-project.org/package=slippymath
  authors:
  - family-names: McBain
    given-names: Miles
    email: miles.mcbain@gmail.com
    orcid: https://orcid.org/0000-0003-2865-2548
  - family-names: Sumner
    given-names: Michael
    email: mdsumner@gmail.com
  year: '2025'
  doi: 10.32614/CRAN.package.slippymath
- type: software
  title: utils
  abstract: 'R: A Language and Environment for Statistical Computing'
  notes: Imports
  authors:
  - name: R Core Team
  institution:
    name: R Foundation for Statistical Computing
    address: Vienna, Austria
  year: '2025'
- type: software
  title: covr
  abstract: 'covr: Test Coverage for Packages'
  notes: Suggests
  url: https://covr.r-lib.org
  repository: https://CRAN.R-project.org/package=covr
  authors:
  - family-names: Hester
    given-names: Jim
    email: james.f.hester@gmail.com
  year: '2025'
  doi: 10.32614/CRAN.package.covr
- type: software
  title: tinytest
  abstract: 'tinytest: Lightweight and Feature Complete Unit Testing Framework'
  notes: Suggests
  url: https://github.com/markvanderloo/tinytest
  repository: https://CRAN.R-project.org/package=tinytest
  authors:
  - family-names: Loo
    given-names: Mark
    name-particle: van der
    email: mark.vanderloo@gmail.com
    orcid: https://orcid.org/0000-0002-9807-4686
  year: '2025'
  doi: 10.32614/CRAN.package.tinytest

CodeMeta (codemeta.json)

{
  "@context": "https://doi.org/10.5063/schema/codemeta-2.0",
  "@type": "SoftwareSourceCode",
  "identifier": "maptiles",
  "description": "To create maps from tiles, 'maptiles' downloads, composes and displays tiles from a large number of providers (e.g. 'OpenStreetMap', 'Stadia', 'Esri', 'CARTO', or 'Thunderforest').",
  "name": "maptiles: Download and Display Map Tiles",
  "codeRepository": "https://github.com/riatelab/maptiles/",
  "issueTracker": "https://github.com/riatelab/maptiles/issues/",
  "license": "https://spdx.org/licenses/GPL-3.0",
  "version": "0.10.0",
  "programmingLanguage": {
    "@type": "ComputerLanguage",
    "name": "R",
    "url": "https://r-project.org"
  },
  "runtimePlatform": "R version 4.5.0 (2025-04-11)",
  "provider": {
    "@id": "https://cran.r-project.org",
    "@type": "Organization",
    "name": "Comprehensive R Archive Network (CRAN)",
    "url": "https://cran.r-project.org"
  },
  "author": [
    {
      "@type": "Person",
      "givenName": "Timothe",
      "familyName": "Giraud",
      "email": "timothee.giraud@cnrs.fr",
      "@id": "https://orcid.org/0000-0002-1932-3323"
    }
  ],
  "contributor": [
    {
      "@type": "Person",
      "givenName": "Diego",
      "familyName": "Hernangmez",
      "@id": "https://orcid.org/0000-0001-8457-4658"
    },
    {
      "@type": "Person",
      "givenName": "Robert J.",
      "familyName": "Hijmans",
      "@id": "https://orcid.org/0000-0001-5872-2872"
    },
    {
      "@type": "Person",
      "givenName": "Hugh A.",
      "familyName": "Graham"
    }
  ],
  "maintainer": [
    {
      "@type": "Person",
      "givenName": "Timothe",
      "familyName": "Giraud",
      "email": "timothee.giraud@cnrs.fr",
      "@id": "https://orcid.org/0000-0002-1932-3323"
    }
  ],
  "softwareSuggestions": [
    {
      "@type": "SoftwareApplication",
      "identifier": "covr",
      "name": "covr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=covr"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "tinytest",
      "name": "tinytest",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=tinytest"
    }
  ],
  "softwareRequirements": {
    "1": {
      "@type": "SoftwareApplication",
      "identifier": "R",
      "name": "R",
      "version": ">= 3.5.0"
    },
    "2": {
      "@type": "SoftwareApplication",
      "identifier": "sf",
      "name": "sf",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=sf"
    },
    "3": {
      "@type": "SoftwareApplication",
      "identifier": "curl",
      "name": "curl",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=curl"
    },
    "4": {
      "@type": "SoftwareApplication",
      "identifier": "digest",
      "name": "digest",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=digest"
    },
    "5": {
      "@type": "SoftwareApplication",
      "identifier": "graphics",
      "name": "graphics"
    },
    "6": {
      "@type": "SoftwareApplication",
      "identifier": "grDevices",
      "name": "grDevices"
    },
    "7": {
      "@type": "SoftwareApplication",
      "identifier": "png",
      "name": "png",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=png"
    },
    "8": {
      "@type": "SoftwareApplication",
      "identifier": "terra",
      "name": "terra",
      "version": ">= 1.8-21",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=terra"
    },
    "9": {
      "@type": "SoftwareApplication",
      "identifier": "tools",
      "name": "tools"
    },
    "10": {
      "@type": "SoftwareApplication",
      "identifier": "slippymath",
      "name": "slippymath",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=slippymath"
    },
    "11": {
      "@type": "SoftwareApplication",
      "identifier": "utils",
      "name": "utils"
    },
    "SystemRequirements": null
  },
  "fileSize": "1452.47KB"
}

GitHub Events

Total
  • Create event: 2
  • Issues event: 9
  • Release event: 3
  • Watch event: 15
  • Issue comment event: 11
  • Push event: 5
Last Year
  • Create event: 2
  • Issues event: 9
  • Release event: 3
  • Watch event: 15
  • Issue comment event: 11
  • Push event: 5

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 153
  • Total Committers: 7
  • Avg Commits per committer: 21.857
  • Development Distribution Score (DDS): 0.137
Past Year
  • Commits: 18
  • Committers: 1
  • Avg Commits per committer: 18.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
rCarto t****d@c****r 132
rCarto t****d@c****r 14
rhijmans r****s@g****m 3
Tadhg Moore t****6@g****m 1
Ryan Hill r****4 1
Paul Carteron c****l@g****m 1
Hugh Graham h****m@g****m 1
Committer Domains (Top 20 + Academic)
cnrs.fr: 2

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 27
  • Total pull requests: 9
  • Average time to close issues: 4 months
  • Average time to close pull requests: 15 days
  • Total issue authors: 16
  • Total pull request authors: 6
  • Average comments per issue: 2.44
  • Average comments per pull request: 1.56
  • Merged pull requests: 7
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 3
  • Pull requests: 0
  • Average time to close issues: about 2 months
  • Average time to close pull requests: N/A
  • Issue authors: 3
  • Pull request authors: 0
  • Average comments per issue: 2.67
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • rCarto (8)
  • mtennekes (2)
  • bergest (2)
  • gremms1 (2)
  • dieghernan (2)
  • tadhg-moore (1)
  • jguelat (1)
  • pietervreeburg (1)
  • cutterkom (1)
  • asitemade4u (1)
  • CorentinVisee (1)
  • paul-carteron (1)
  • oloverm (1)
  • amygimma (1)
  • brry (1)
Pull Request Authors
  • rhijmans (3)
  • rCarto (2)
  • tadhg-moore (1)
  • h-a-graham (1)
  • rlh1994 (1)
  • paul-carteron (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 21,243 last-month
  • Total docker downloads: 29
  • Total dependent packages: 3
  • Total dependent repositories: 7
  • Total versions: 13
  • Total maintainers: 1
cran.r-project.org: maptiles

Download and Display Map Tiles

  • Versions: 13
  • Dependent Packages: 3
  • Dependent Repositories: 7
  • Downloads: 21,243 Last month
  • Docker Downloads: 29
Rankings
Stargazers count: 4.4%
Forks count: 7.3%
Dependent repos count: 11.1%
Downloads: 11.1%
Average: 12.1%
Dependent packages count: 13.7%
Docker downloads count: 24.8%
Maintainers (1)
Last synced: 4 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.5.0 depends
  • curl * imports
  • grDevices * imports
  • graphics * imports
  • png * imports
  • sf >= 0.9 imports
  • slippymath * imports
  • terra * imports
  • tools * imports
  • covr * suggests
  • tinytest * suggests
.github/workflows/check-standard.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite