maposm

R package to download, simplify and merge multiple geographic layers from OpenStreetMap for mapping purposes.

https://github.com/riatelab/maposm

Science Score: 52.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
  • Academic email domains
  • Institutional organization owner
    Organization riatelab has institutional domain (riate.cnrs.fr)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.3%) to scientific vocabulary

Keywords

cartography maps openstreetmap r
Last synced: 6 months ago · JSON representation ·

Repository

R package to download, simplify and merge multiple geographic layers from OpenStreetMap for mapping purposes.

Basic Info
  • Host: GitHub
  • Owner: riatelab
  • Language: R
  • Default Branch: main
  • Homepage:
  • Size: 4.11 MB
Statistics
  • Stars: 22
  • Watchers: 1
  • Forks: 1
  • Open Issues: 0
  • Releases: 0
Topics
cartography maps openstreetmap r
Created about 1 year ago · Last pushed 10 months ago
Metadata Files
Readme Citation Codemeta

README.Rmd

---
output: github_document
---

```{r, include=FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-")

```

# maposm 

[![maposm status badge](https://riatelab.r-universe.dev/maposm/badges/version)](https://riatelab.r-universe.dev/maposm)

The [OpenStreetMap](https://www.openstreetmap.org/) database provides numerous and very detailed geographic layers on a global scale. 
To obtain synthetic information that can be used for cartographic purposes, layers must be selected, simplified, merged, or modified.  
The `maposm` package provides a set of composite layers that are built from extractions performed with the [`osmdata`](https://docs.ropensci.org/osmdata/) package (which itself uses the [Overpass API](https://wiki.openstreetmap.org/wiki/Overpass_API)). 

The resulting layers are:

- Urban areas
- Buildings
- Green spaces
- Main roads 
- Secondary roads 
- Railroads 
- Water bodies

## Installation

You can install `maposm` from the r-universe.

```{r, eval=FALSE}
install.packages("maposm", repos = "https://riatelab.r-universe.dev")
```


## Demo

`om_get()` is used to download, merge and simplify the geographic layers.       
`om_map()` can be used to map the layers. 

```{r example, fig.width=7, fig.height=7}
library(maposm)
castries = om_get(x = c(-60.9903, 14.0096), r = 2000)
om_map(x = castries, title = "Castries, Saint Lucia", theme = "light")
```

Several themes are available to map the layers ("light", "dark" and "grey").

```{r example2, fig.width=7, fig.height=7}
om_map(x = castries, title = "Castries, Saint Lucia", theme = "grey")
```

You can also use an sf object to extract the layers 
and your prefered library to map the layers.   
```{r example3, fig.width=7, fig.height=7}
library(mapsf)
roseau = st_as_sf(data.frame(lat = 15.300, lon = -61.388), 
                   coords = c("lon", "lat"), 
                   crs = "EPSG:4326") |>
  st_transform("EPSG:3857") |>
  st_buffer(dist = 500, nQuadSegs = 2) |> 
  om_get(quiet = TRUE)

mf_map(roseau$zone, col = "#f2efe9", border = NA, add = FALSE)
mf_map(roseau$urban, col = "#e0dfdf", border = "#e0dfdf", lwd = .5, add = TRUE)
mf_map(roseau$green, col = "#c8facc", border = "#c8facc", lwd = .5, add = TRUE)
mf_map(roseau$water, col = "#aad3df", border = "#aad3df", lwd = .5, add = TRUE)
mf_map(roseau$railway, col = "grey50", lty = 2, lwd = .2, add = TRUE)
mf_map(roseau$road, col = "white", border = "white", lwd = .5, add = TRUE)
mf_map(roseau$street, col = "white", border = "white", lwd = .5, add = TRUE)
mf_map(roseau$building, col = "#d9d0c9", border = "#c6bab1", lwd = .5, add = TRUE)
mf_map(roseau$zone, col = NA, border = "#c6bab1", lwd = 4, add = TRUE)
mf_credits(txt = "\ua9 OpenStreetMap contributors")
mf_scale(size = 100, scale_units = "m")
mf_title("Roseau, Dominique")
```


`om_write()` can be used to write the layers to a geopackage file.     
`om_read()` can be used to read the geopackages. 

```{r, eval=FALSE}
# save
om_write(x = roseau, filename = "roseau.gpkg")
# import
om_read(x = "roseau.gpkg")
```


## Alternatives

- [`osmdata`](https://github.com/ropensci/osmdata) to access to OSM data through the overpass API
- [`osmplotr`](https://docs.ropensci.org/osmplotr/) from the author of `osmdata`
- [`osmextract`](https://docs.ropensci.org/osmextract/) for large extracts from OSM 
- [`prettymap`](https://github.com/marceloprates/prettymaps) is a full featured Python library
- [`mapBliss`](https://github.com/benyamindsmith/mapBliss) to plot flight paths and road trips on OSM map
- [`maptiles`](https://github.com/riatelab/maptiles) to download (raster) OSM map tiles


## Community Guidelines

One can contribute to the package through [pull
requests](https://github.com/riatelab/maposm/pulls) and report issues or
ask questions [here](https://github.com/riatelab/maposm/issues).
This project uses [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0-beta.3/) and
[semantic versioning](https://semver.org/).

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 "maposm" in publications use:'
type: software
license: GPL-3.0-only
title: 'maposm: Get Map Layers from OpenStreetMap'
version: 0.1.0
abstract: Download and assemble multiple geographic layers from the OpenStreetMap
  database for mapping purposes.
authors:
- family-names: Giraud
  given-names: Timothée
  email: timothee.giraud@cnrs.fr
  orcid: https://orcid.org/0000-0002-1932-3323
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.6.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: lwgeom
  abstract: 'lwgeom: Bindings to Selected ''liblwgeom'' Functions for Simple Features'
  notes: Imports
  url: https://r-spatial.github.io/lwgeom/
  repository: https://CRAN.R-project.org/package=lwgeom
  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.lwgeom
- type: software
  title: tictoc
  abstract: 'tictoc: Functions for Timing R Scripts, as Well as Implementations of
    "Stack" and "StackList" Structures'
  notes: Imports
  url: https://github.com/jabiru/tictoc
  repository: https://CRAN.R-project.org/package=tictoc
  authors:
  - family-names: Izrailev
    given-names: Sergei
  year: '2025'
  doi: 10.32614/CRAN.package.tictoc
- 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: mapsf
  abstract: 'mapsf: Thematic Cartography'
  notes: Imports
  url: https://riatelab.github.io/mapsf/
  repository: https://CRAN.R-project.org/package=mapsf
  authors:
  - family-names: Giraud
    given-names: Timothée
    email: timothee.giraud@cnrs.fr
    orcid: https://orcid.org/0000-0002-1932-3323
  doi: 10.32614/CRAN.package.mapsf
  year: '2025'
- 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: osmdata
  abstract: 'osmdata: Import ''OpenStreetMap'' Data as Simple Features or Spatial
    Objects'
  notes: Imports
  url: https://docs.ropensci.org/osmdata/
  repository: https://CRAN.R-project.org/package=osmdata
  authors:
  - family-names: Padgham
    given-names: Mark
    email: mark.padgham@email.com
  - family-names: Rudis
    given-names: Bob
  - family-names: Lovelace
    given-names: Robin
  - family-names: Salmon
    given-names: Maëlle
  - family-names: Maspons
    given-names: Joan
    orcid: https://orcid.org/0000-0003-2286-8727
  year: '2025'
  doi: 10.32614/CRAN.package.osmdata

CodeMeta (codemeta.json)

{
  "@context": "https://doi.org/10.5063/schema/codemeta-2.0",
  "@type": "SoftwareSourceCode",
  "identifier": "maposm",
  "description": "Download and assemble multiple geographic layers from the OpenStreetMap database for mapping purposes.",
  "name": "maposm: Get Map Layers from OpenStreetMap",
  "license": "https://spdx.org/licenses/GPL-3.0",
  "version": "0.2.0",
  "programmingLanguage": {
    "@type": "ComputerLanguage",
    "name": "R",
    "url": "https://r-project.org"
  },
  "runtimePlatform": "R version 4.5.1 (2025-06-13)",
  "author": [
    {
      "@type": "Person",
      "givenName": "Timothe",
      "familyName": "Giraud",
      "email": "timothee.giraud@cnrs.fr",
      "@id": "https://orcid.org/0000-0002-1932-3323"
    }
  ],
  "contributor": [
    {
      "@type": "Person",
      "givenName": "Matthieu",
      "familyName": "Viry",
      "@id": "https://orcid.org/0000-0002-0693-8556"
    },
    {
      "@type": "Person",
      "givenName": "Louis",
      "familyName": "Laurian",
      "@id": "https://orcid.org/0009-0002-7275-5536"
    }
  ],
  "maintainer": [
    {
      "@type": "Person",
      "givenName": "Timothe",
      "familyName": "Giraud",
      "email": "timothee.giraud@cnrs.fr",
      "@id": "https://orcid.org/0000-0002-1932-3323"
    }
  ],
  "softwareRequirements": {
    "1": {
      "@type": "SoftwareApplication",
      "identifier": "R",
      "name": "R",
      "version": ">= 4.1.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": "lwgeom",
      "name": "lwgeom",
      "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=lwgeom"
    },
    "4": {
      "@type": "SoftwareApplication",
      "identifier": "tictoc",
      "name": "tictoc",
      "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=tictoc"
    },
    "5": {
      "@type": "SoftwareApplication",
      "identifier": "tools",
      "name": "tools"
    },
    "6": {
      "@type": "SoftwareApplication",
      "identifier": "mapsf",
      "name": "mapsf",
      "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=mapsf"
    },
    "7": {
      "@type": "SoftwareApplication",
      "identifier": "graphics",
      "name": "graphics"
    },
    "8": {
      "@type": "SoftwareApplication",
      "identifier": "osmdata",
      "name": "osmdata",
      "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=osmdata"
    },
    "SystemRequirements": null
  },
  "fileSize": "2193.843KB"
}

GitHub Events

Total
  • Watch event: 20
  • Push event: 10
  • Pull request event: 2
  • Fork event: 1
Last Year
  • Watch event: 20
  • Push event: 10
  • Pull request event: 2
  • Fork event: 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 0
  • Total pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: 5 days
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: 5 days
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • louislrn (2)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

DESCRIPTION cran
  • R >= 3.6.0 depends
  • osmdata * imports
  • sf * imports
  • tictoc * imports