Package 'maposm'

Title: Get Map Layers from OpenStreetMap
Description: Download and assemble multiple geographic layers from the OpenStreetMap database for mapping purposes.
Authors: Timothée Giraud [cre, aut] (ORCID: <https://orcid.org/0000-0002-1932-3323>), Matthieu Viry [ctb] (ORCID: <https://orcid.org/0000-0002-0693-8556>), Louis Laurian [ctb] (ORCID: <https://orcid.org/0009-0002-7275-5536>)
Maintainer: Timothée Giraud <[email protected]>
License: GPL-3
Version: 0.2.0
Built: 2026-05-29 19:53:35 UTC
Source: https://github.com/riatelab/maposm

Help Index


Get map layers

Description

Download various OpenStreetMap features to create map layers.

Usage

om_get(x, r = 1000, quiet = FALSE)

Arguments

x

an sf or sfc object, or a couple of coordinates

r

radi of the extraction if x is an sf POINT or a couple of coordinates

quiet

suppress info

Value

A list of map layers is returned :

  • zone, the extraction zone;

  • urban, urban areas;

  • building, buildings (if the extraction zone area is below 20 km²);

  • green, green spaces;

  • road, main roads;

  • street, secondary roads;

  • railway, railroads (line);

  • water, water bodies If input (x) uses an unprojected CRS (lon/lat, EPSG:4326), ouput uses Web Mercator CRS (EPSG:3857), it uses x CRS otherwise.

Examples

## Not run: 
bb1 = osmdata::getbb("Gare Matabiau, 31000 TOULOUSE, France")
lon = mean(bb1[1, ])
lat = mean(bb1[2, ])
res = om_get(c(lon, lat), r = 700)
om_map(res)

## End(Not run)

Map layers

Description

Display a map of the downloaded layers.

Usage

om_map(x, title = "Data from OpenStreetMap", theme = "light")

Arguments

x

a list of map layers

title

map title

theme

cartographic theme; "light", "dark", "grey" or "pizza"

Value

Nothing is returned. A map is displayed.

Examples

## Not run: 
r = om_get(c(1.453587,43.611408), 700)
om_map(r, "Matabiau neighbourhood", "light")

## End(Not run)

Import a list of map layers

Description

Read and import a list of layers.

Usage

om_read(filename)

Arguments

filename

a geopackage file

Value

A list of map layers is returned.

Examples

## Not run: 
r = om_get(c(2.17, 41.39), 500)
om_write(r, "bcn.gpkg")
r = om_read("bcn.gpkg")
om_map(r)

## End(Not run)

Save map layers to a file

Description

Write a list a map of layers to a geopackage file.

Usage

om_write(x, filename)

Arguments

x

a list of map layers produce with om_get

filename

a geopackage file

Value

The layers are saved to a geopackage file. Nothing is returned.

Examples

## Not run: 
r = om_get(c(2.17, 41.39), 500)
(om_write(r, "bcn.gpkg"))

## End(Not run)